Added spdylay_before_ctrl_send_callback

This commit is contained in:
Tatsuhiro Tsujikawa 2012-01-28 17:25:14 +09:00
parent 7016fe1b75
commit 27e1bcab9e
2 changed files with 16 additions and 1 deletions

View File

@ -221,6 +221,15 @@ typedef void (*spdylay_on_data_send_callback)
(spdylay_session *session, uint8_t flags, int32_t stream_id, int32_t length, (spdylay_session *session, uint8_t flags, int32_t stream_id, int32_t length,
void *user_data); void *user_data);
/*
* Callback function invoked before frame |frame| of type |type| is
* sent. This may be useful, for example, to know the stream ID of
* SYN_STREAM frame, which is not assigned when it was queued.
*/
typedef void (*spdylay_before_ctrl_send_callback)
(spdylay_session *session, spdylay_frame_type type, spdylay_frame *frame,
void *user_data);
typedef struct { typedef struct {
spdylay_send_callback send_callback; spdylay_send_callback send_callback;
spdylay_recv_callback recv_callback; spdylay_recv_callback recv_callback;
@ -229,6 +238,7 @@ typedef struct {
spdylay_on_ping_recv_callback on_ping_recv_callback; spdylay_on_ping_recv_callback on_ping_recv_callback;
spdylay_on_data_chunk_recv_callback on_data_chunk_recv_callback; spdylay_on_data_chunk_recv_callback on_data_chunk_recv_callback;
spdylay_on_data_recv_callback on_data_recv_callback; spdylay_on_data_recv_callback on_data_recv_callback;
spdylay_before_ctrl_send_callback before_ctrl_send_callback;
spdylay_on_ctrl_send_callback on_ctrl_send_callback; spdylay_on_ctrl_send_callback on_ctrl_send_callback;
spdylay_on_data_send_callback on_data_send_callback; spdylay_on_data_send_callback on_data_send_callback;
} spdylay_session_callbacks; } spdylay_session_callbacks;

View File

@ -519,7 +519,12 @@ int spdylay_session_send(spdylay_session *session)
session->aob.item = item; session->aob.item = item;
session->aob.framebuf = framebuf; session->aob.framebuf = framebuf;
session->aob.framebuflen = framebuflen; session->aob.framebuflen = framebuflen;
/* TODO Call before_send callback */ /* Call before_send callback */
if(item->frame_type != SPDYLAY_DATA &&
session->callbacks.before_ctrl_send_callback) {
session->callbacks.before_ctrl_send_callback
(session, item->frame_type, item->frame, session->user_data);
}
} }
data = session->aob.framebuf + session->aob.framebufoff; data = session->aob.framebuf + session->aob.framebufoff;
datalen = session->aob.framebuflen - session->aob.framebufoff; datalen = session->aob.framebuflen - session->aob.framebufoff;