
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