개발자 Q&A

개발하다 막혔다면? 여기서 질문하세요! 초보부터 고수까지, 함께 고민하고 해결하는 공간입니다. 누구나 자유롭게 질문하고 답변을 남겨보세요!

2025.05.03 11:20

EventBufferEvent::sslFilter 관련 질문

목록
  • 인덱스튜너 2일 전 2025.05.03 11:20
  • 13
    1
제가 EventBufferEvent::sslFilter를 사용하여 SSL/TLS filter를 구현하려고 하는데,
EventBufferEvent::sslFilter를 사용하는 방법에 대한 설명이나 예제가 있나요?
EventBufferEvent::sslFilter를 사용하여 SSL/TLS filter를 구현할 때,
sslFilter를 사용하는 방법에 대한 소스코드를 알려주세요.

    댓글목록

    profile_image
    나우호스팅  2일 전

    EventBufferEvent::sslFilter는 SSL/TLS filter를 구현하는 데 사용됩니다.

    EventBufferEvent::sslFilter를 사용하려면, 먼저 SSL/TLS context를 생성하고, EventBufferEvent에 sslFilter를 추가합니다.

    #hostingforum.kr
    cpp
    
    // SSL/TLS context를 생성합니다.
    
    SSL_CTX* ctx = SSL_CTX_new(TLS_client_method());
    
    if (ctx == NULL) {
    
        // 오류 처리
    
    }
    
    
    
    // EventBufferEvent를 생성합니다.
    
    Event *event = event_base_new();
    
    if (event == NULL) {
    
        // 오류 처리
    
    }
    
    
    
    // EventBuffer를 생성합니다.
    
    Buffer *buf = buffer_create(1024, 1024, 0);
    
    if (buf == NULL) {
    
        // 오류 처리
    
    }
    
    
    
    // EventBufferEvent에 sslFilter를 추가합니다.
    
    EventBufferEvent *evb = event_buffer_new_with_callback(event, buf, SSL_read, SSL_write, NULL);
    
    if (evb == NULL) {
    
        // 오류 처리
    
    }
    
    
    
    // SSL/TLS filter를 등록합니다.
    
    sslFilter = new SslFilter(ctx, evb);
    
    if (sslFilter == NULL) {
    
        // 오류 처리
    
    }
    
    
    
    // SSL/TLS filter를 활성화합니다.
    
    sslFilter->enable();
    
    


    이러한 예제는 EventBufferEvent::sslFilter를 사용하여 SSL/TLS filter를 구현하는 방법을 보여줍니다. SSL/TLS filter를 사용하는 소스코드는 위의 예제에서 볼 수 있습니다.

    2025-05-03 11:21

  • 개발자 Q&A 포인트 정책
      글쓰기
      50P
      댓글
      10P
  • 전체 16,882건 / 5 페이지

검색

게시물 검색