yumapro  20.10-10
YumaPro SDK
Session Message Support

Session messages are used by sessions and stored in ses_msg_t. More...

Collaboration diagram for Session Message Support:

Data Structures

struct  ses_msg_tempchunk_t
 save the chunks before putting them back into ses_buff_t structs More...
 

Functions

void ses_msg_init (void)
 Initialize the session message manager module data structures. More...
 
void ses_msg_cleanup (void)
 Cleanup the session message manager module data structures. More...
 
status_t ses_msg_new_msg (ses_msg_t **msg)
 Malloc a new session message control header. More...
 
void ses_msg_free_msg (ses_cb_t *scb, ses_msg_t *msg)
 Free the session message and all its buffer chunks. More...
 
status_t ses_msg_new_buff (ses_cb_t *scb, boolean outbuff, ses_msg_buff_t **buff)
 Malloc a new session buffer chuck. More...
 
void ses_msg_free_buff (ses_cb_t *scb, ses_msg_buff_t *buff)
 Free the session buffer chunk. More...
 
status_t ses_msg_write_buff (ses_cb_t *scb, ses_msg_buff_t *buff, xmlChar ch)
 Add some text to the message buffer. More...
 
status_t ses_msg_send_buffs (ses_cb_t *scb, boolean *anyout)
 Send multiple buffers to the session client socket Tries to send one packet at maximum MTU. More...
 
status_t ses_msg_new_output_buff (ses_cb_t *scb, boolean start_chunk_mode)
 Put the current outbuff on the outQ. More...
 
void ses_msg_make_inready (ses_cb_t *scb)
 Put the session on the inreadyQ if it is not already there. More...
 
void ses_msg_make_outready (ses_cb_t *scb)
 Put the session on the outreadyQ if it is not already there. More...
 
void ses_msg_make_outready_ycontrol (ses_cb_t *scb)
 Put the session on the outreadyQ if it is not already there. More...
 
void ses_msg_finish_outmsg (ses_cb_t *scb)
 Put the outbuff in the outQ if non-empty. More...
 
ses_ready_tses_msg_get_first_inready (boolean ycontrol)
 Dequeue the first entry in the inreadyQ, if any. More...
 
ses_ready_tses_msg_get_first_inready_ses (ses_id_t sid)
 Dequeue the first matching session entry in the inreadyQ, if any. More...
 
ses_ready_tses_msg_get_first_outready (void)
 Dequeue the first entry in the outreadyQ, if any. More...
 
ses_ready_tses_msg_get_first_outready_ycontrol (void)
 Dequeue the first entry in the outreadyQ, if any Get a ycontrol entry. More...
 
void ses_msg_dump (log_debug_t lvl, const ses_msg_t *msg, const xmlChar *text)
 Dump the message contents. More...
 
void ses_msg_add_framing (ses_cb_t *scb, ses_msg_buff_t *buff)
 Add the base:1.1 framing chars to the buffer and adjust the buffer size pointers. More...
 
void ses_msg_init_buff (ses_cb_t *scb, boolean outbuff, ses_msg_buff_t *buff)
 Init the buffer fields. More...
 
status_t ses_msg_reset_message (ses_cb_t *scb, ses_msg_t *msg, dlq_hdr_t *tempchunkQ)
 Reset a message to the provided buffer. More...
 
ses_msg_tempchunk_tses_msg_new_tempchunk (xmlChar *chunk, uint32 chunklen)
 Create a new temp chunk. More...
 
void ses_msg_free_tempchunk (ses_msg_tempchunk_t *tc)
 Free a temp chunk. More...
 
void ses_msg_clean_tempchunkQ (dlq_hdr_t *tempchunkQ)
 Clean a Q of ses_msg_tempchunk_t structs. More...
 
uint32 ses_msg_size_tempchunkQ (dlq_hdr_t *tempchunkQ)
 Get the size of the message in the tempchunks. More...
 
ses_msg_buff_tses_msg_first_outbuff (ses_cb_t *scb)
 Get the first outQ buffer. More...
 
ses_msg_buff_tses_msg_next_outbuff (ses_cb_t *scb, ses_msg_buff_t *curbuff)
 Get the next outQ buffer. More...
 
size_t ses_msg_buff_size (ses_msg_buff_t *buff)
 Get the number of bytes in the buffer (not the buffer size) More...
 
size_t ses_msg_copy_buff (ses_msg_buff_t *buff, xmlChar *retbuff, size_t retbuff_size)
 Copy the buffer data to another buffer. More...
 
void ses_msg_clean_outbuffs (ses_cb_t *scb)
 Clean the message out buffers for next use. More...
 
xmlChar * ses_msg_convert_outbuffs (ses_cb_t *scb, uint32 *len)
 Clean the message out buffers for next use. More...
 
status_t ses_msg_add_input_msg (ses_cb_t *scb, xmlChar *data, size_t datalen)
 Make a ses_msg_t to fool the session handler into thinking the HTTP code path filled in a session input message. More...
 
void ses_msg_clean_msgQ (ses_cb_t *scb)
 Clean all the input messages use by the scb Used by YP-COAP. More...
 

Detailed Description

Session messages are used by sessions and stored in ses_msg_t.

Each session can have a queue of inbound and outbound messages.

Function Documentation

void ses_msg_add_framing ( ses_cb_t scb,
ses_msg_buff_t buff 
)

Add the base:1.1 framing chars to the buffer and adjust the buffer size pointers.

Parameters
scbsession control block
buffbuffer control block
Return values
buff->buffhas framing chars added
status_t ses_msg_add_input_msg ( ses_cb_t scb,
xmlChar *  data,
size_t  datalen 
)

Make a ses_msg_t to fool the session handler into thinking the HTTP code path filled in a session input message.

This will be text based line-by-line parsing done by ses_getline_cb Used by YP-COAP

Parameters
scbsession to use
datacoap message body
datalencoap message body length
Return values
scb->msgQhas message created and added
Returns
status

Here is the call graph for this function:

size_t ses_msg_buff_size ( ses_msg_buff_t buff)

Get the number of bytes in the buffer (not the buffer size)

Parameters
buffbuffer to check
Returns
number of message body bytes in the buffer

Here is the caller graph for this function:

void ses_msg_clean_msgQ ( ses_cb_t scb)

Clean all the input messages use by the scb Used by YP-COAP.

Parameters
scbsession to use
Return values
scb->msgQcleaned

Here is the call graph for this function:

void ses_msg_clean_outbuffs ( ses_cb_t scb)

Clean the message out buffers for next use.

Parameters
scb== session control block

Here is the call graph for this function:

void ses_msg_clean_tempchunkQ ( dlq_hdr_t *  tempchunkQ)

Clean a Q of ses_msg_tempchunk_t structs.

Parameters
tempchunkQ== que to use

Here is the call graph for this function:

void ses_msg_cleanup ( void  )

Cleanup the session message manager module data structures.

Here is the call graph for this function:

Here is the caller graph for this function:

xmlChar* ses_msg_convert_outbuffs ( ses_cb_t scb,
uint32 *  len 
)

Clean the message out buffers for next use.

Convert all the buffers into 1 big buffer Used by mgr_coap to send Block1 request data

Parameters
scbsession control block
lenaddress of return len
Return values
*lennumber of bytes in return buffer
Returns
malloced buffer containing all outbuff content

Here is the call graph for this function:

size_t ses_msg_copy_buff ( ses_msg_buff_t buff,
xmlChar *  retbuff,
size_t  retbuff_size 
)

Copy the buffer data to another buffer.

Parameters
buffbuffer to copy from
retbuffbuffer to copy into
retbuff_sizelength of retbuff
Returns
number of bytes written to the buffer

Here is the call graph for this function:

void ses_msg_dump ( log_debug_t  lvl,
const ses_msg_t msg,
const xmlChar *  text 
)

Dump the message contents.

Parameters
lvldebug level for filtering. Output (if any) at LOG_DEBUG_WRITE.
msgmessage to dump
textstart text before message dump (may be NULL)

Here is the call graph for this function:

Here is the caller graph for this function:

void ses_msg_finish_outmsg ( ses_cb_t scb)

Put the outbuff in the outQ if non-empty.

Put the session on the outreadyQ if it is not already there

Parameters
scbsession control block
Return values
scb->outreadywill be queued on the outreadyQ

Here is the call graph for this function:

Here is the caller graph for this function:

ses_msg_buff_t* ses_msg_first_outbuff ( ses_cb_t scb)

Get the first outQ buffer.

Parameters
scbsession control block
Returns
pointer to the first outbuff
void ses_msg_free_buff ( ses_cb_t scb,
ses_msg_buff_t buff 
)

Free the session buffer chunk.

Parameters
scbsession control block owning the message
buffbuffer to free (already removed from any Q)

Here is the call graph for this function:

Here is the caller graph for this function:

void ses_msg_free_msg ( ses_cb_t scb,
ses_msg_t msg 
)

Free the session message and all its buffer chunks.

Parameters
scbsession control block owning the message
msgmessage to free (already removed from any Q)

Here is the call graph for this function:

Here is the caller graph for this function:

void ses_msg_free_tempchunk ( ses_msg_tempchunk_t tc)

Free a temp chunk.

Parameters
tctempchunk to delete

Here is the caller graph for this function:

ses_ready_t* ses_msg_get_first_inready ( boolean  ycontrol)

Dequeue the first entry in the inreadyQ, if any.

Parameters
ycontrolTRUE if only YControl sessions should be processed
FALSE to process any session type
Returns
first entry in the inreadyQ or NULL if none

Here is the call graph for this function:

Here is the caller graph for this function:

ses_ready_t* ses_msg_get_first_inready_ses ( ses_id_t  sid)

Dequeue the first matching session entry in the inreadyQ, if any.

Parameters
sidfirst matching session entry in the inreadyQ or NULL if none

Here is the call graph for this function:

Here is the caller graph for this function:

ses_ready_t* ses_msg_get_first_outready ( void  )

Dequeue the first entry in the outreadyQ, if any.

Returns
first entry in the outreadyQ or NULL if none

Here is the call graph for this function:

Here is the caller graph for this function:

ses_ready_t* ses_msg_get_first_outready_ycontrol ( void  )

Dequeue the first entry in the outreadyQ, if any Get a ycontrol entry.

Returns
first entry in the outreadyQ or NULL if none

Here is the call graph for this function:

Here is the caller graph for this function:

void ses_msg_init ( void  )

Initialize the session message manager module data structures.

Here is the call graph for this function:

Here is the caller graph for this function:

void ses_msg_init_buff ( ses_cb_t scb,
boolean  outbuff,
ses_msg_buff_t buff 
)

Init the buffer fields.

Parameters
scbsession control block
outbuffTRUE if oupput buffer; FALSE if input buffer
buffbuffer to send

Here is the caller graph for this function:

void ses_msg_make_inready ( ses_cb_t scb)

Put the session on the inreadyQ if it is not already there.

Parameters
scbsession control block
Return values
scb->inreadywill be queued on the inreadyQ

Here is the call graph for this function:

Here is the caller graph for this function:

void ses_msg_make_outready ( ses_cb_t scb)

Put the session on the outreadyQ if it is not already there.

Parameters
scbsession control block
Return values
scb->outreadywill be queued on the outreadyQ

Here is the call graph for this function:

Here is the caller graph for this function:

void ses_msg_make_outready_ycontrol ( ses_cb_t scb)

Put the session on the outreadyQ if it is not already there.

Parameters
scbsession control block
Return values
scb->outreadywill be queued on the outreadyQ

Here is the call graph for this function:

Here is the caller graph for this function:

status_t ses_msg_new_buff ( ses_cb_t scb,
boolean  outbuff,
ses_msg_buff_t **  buff 
)

Malloc a new session buffer chuck.

Note that the buffer memory is not cleared after each use since this is not needed for byte stream IO

Parameters
scbsession control block to malloc a new message for
outbuffTRUE if this is for outgoing message
FALSE if this is for incoming message
buffaddress of ses_msg_buff_t pointer that will be set
Return values
*buffmalloced session buffer chunk (if NO_ERR return)
Returns
status

Here is the call graph for this function:

Here is the caller graph for this function:

status_t ses_msg_new_msg ( ses_msg_t **  msg)

Malloc a new session message control header.

Parameters
msgaddress of ses_msg_t pointer that will be set
Return values
*msgmalloced session message struct (if NO_ERR return)
Returns
status

Here is the call graph for this function:

Here is the caller graph for this function:

status_t ses_msg_new_output_buff ( ses_cb_t scb,
boolean  start_chunk_mode 
)

Put the current outbuff on the outQ.

Put the session on the outreadyQ if it is not already there Try to allocate a new buffer for the session

Parameters
scbsession control block
start_chunk_modeTRUE if http_chunk_mode should be started before the next buffer is allocated
Return values
scb->outbuffis filled in
scb->outreadycould be set
scb->outQcould be changed
Returns
status, could return malloc or buffers exceeded error

Here is the call graph for this function:

Here is the caller graph for this function:

ses_msg_tempchunk_t* ses_msg_new_tempchunk ( xmlChar *  chunk,
uint32  chunklen 
)

Create a new temp chunk.

Parameters
chunkchunk to store (memory passed off here)
chunklenbyte length of chunk
Returns
pointer to malloced and filled in tempchunk_t
ses_msg_buff_t* ses_msg_next_outbuff ( ses_cb_t scb,
ses_msg_buff_t curbuff 
)

Get the next outQ buffer.

Parameters
scbsession control block
curbuffcurrent buffer
Returns
pointer to the next outbuff
status_t ses_msg_reset_message ( ses_cb_t scb,
ses_msg_t msg,
dlq_hdr_t *  tempchunkQ 
)

Reset a message to the provided buffer.

This is used by HTTP client because its accept_buffer does not do de-chunking inline like the NETCONF buffer_accept code.

Parameters
scbsession control block to use
msgmessage to change
tempchunkQQ of ses_msg_tempchunk_t structs
Returns
status

Here is the call graph for this function:

status_t ses_msg_send_buffs ( ses_cb_t scb,
boolean *  anyout 
)

Send multiple buffers to the session client socket Tries to send one packet at maximum MTU.

Parameters
scbsession control block
anyoutaddress of return output flag (may be NULL)
Return values
*anyout= TRUE if any logging output
FALSE if no logging output
Returns
status

Here is the call graph for this function:

Here is the caller graph for this function:

uint32 ses_msg_size_tempchunkQ ( dlq_hdr_t *  tempchunkQ)

Get the size of the message in the tempchunks.

Parameters
tempchunkQque to use
Returns
byte count for all chunks
status_t ses_msg_write_buff ( ses_cb_t scb,
ses_msg_buff_t buff,
xmlChar  ch 
)

Add some text to the message buffer.

Parameters
scbsession control block to use
buffbuffer to write to
chxmlChar to write
Returns
status_t

Here is the caller graph for this function: