From a657208ffd164c31081c8275a745c953f4df3ea2 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 28 Jan 2012 04:28:39 +0900 Subject: [PATCH] Added spdylay_on_{ctrl,data}_sent_callback functions --- lib/includes/spdylay/spdylay.h | 17 +++++++++++++++++ lib/spdylay_session.c | 12 ++++++++++++ 2 files changed, 29 insertions(+) diff --git a/lib/includes/spdylay/spdylay.h b/lib/includes/spdylay/spdylay.h index 5dfcacce..3f8358ee 100644 --- a/lib/includes/spdylay/spdylay.h +++ b/lib/includes/spdylay/spdylay.h @@ -206,6 +206,21 @@ typedef void (*spdylay_on_data_recv_callback) (spdylay_session *session, uint8_t flags, int32_t stream_id, int32_t length, void *user_data); +/* + * Callback function invoked after frame |frame| of type |type| is + * sent. + */ +typedef void (*spdylay_on_ctrl_send_callback) +(spdylay_session *session, spdylay_frame_type type, spdylay_frame *frame, + void *user_data); + +/* + * Callback function invoked after DATA frame is sent. + */ +typedef void (*spdylay_on_data_send_callback) +(spdylay_session *session, uint8_t flags, int32_t stream_id, int32_t length, + void *user_data); + typedef struct { spdylay_send_callback send_callback; spdylay_recv_callback recv_callback; @@ -214,6 +229,8 @@ typedef struct { spdylay_on_ping_recv_callback on_ping_recv_callback; spdylay_on_data_chunk_recv_callback on_data_chunk_recv_callback; spdylay_on_data_recv_callback on_data_recv_callback; + spdylay_on_ctrl_send_callback on_ctrl_send_callback; + spdylay_on_data_send_callback on_data_send_callback; } spdylay_session_callbacks; int spdylay_session_client_new(spdylay_session **session_ptr, diff --git a/lib/spdylay_session.c b/lib/spdylay_session.c index 2a9e223c..44e736bf 100644 --- a/lib/spdylay_session.c +++ b/lib/spdylay_session.c @@ -399,6 +399,18 @@ static int spdylay_session_after_frame_sent(spdylay_session *session) /* TODO handle FIN flag. */ spdylay_frame *frame = session->aob.item->frame; spdylay_frame_type type = session->aob.item->frame_type; + if(type == SPDYLAY_DATA) { + if(session->callbacks.on_data_send_callback) { + session->callbacks.on_data_send_callback + (session, frame->data.flags, frame->data.stream_id, + session->aob.framebuflen, session->user_data); + } + } else { + if(session->callbacks.on_ctrl_send_callback) { + session->callbacks.on_ctrl_send_callback + (session, type, frame, session->user_data); + } + } switch(type) { case SPDYLAY_SYN_STREAM: { spdylay_stream *stream =