yumapro
24.10-3
YumaPro SDK
|
Session messages are used by sessions and stored in ses_msg_t. More...
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_t * | ses_msg_get_first_inready (boolean ycontrol) |
Dequeue the first entry in the inreadyQ, if any. More... | |
ses_ready_t * | ses_msg_get_first_inready_ses (ses_id_t sid) |
Dequeue the first matching session entry in the inreadyQ, if any. More... | |
ses_ready_t * | ses_msg_get_first_outready (void) |
Dequeue the first entry in the outreadyQ, if any. More... | |
ses_ready_t * | ses_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_t * | ses_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_t * | ses_msg_first_outbuff (ses_cb_t *scb) |
Get the first outQ buffer. More... | |
ses_msg_buff_t * | ses_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... | |
boolean | ses_msg_is_binary (const ses_msg_t *msg) |
Check if the message is a binary message Used by YANG-CBOR. More... | |
xmlChar * | ses_msg_get_onebuff (ses_msg_t *msg, xmlChar **retbuff, uint32 *retlen) |
Get the entire message as 1 buffer. More... | |
Session messages are used by sessions and stored in ses_msg_t.
Each session can have a queue of inbound and outbound messages.
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.
scb | session control block | |
[in,out] | buff | buffer control block
|
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
[in,out] | scb | session to use
|
data | coap message body | |
datalen | coap message body length |
size_t ses_msg_buff_size | ( | ses_msg_buff_t * | buff | ) |
Get the number of bytes in the buffer (not the buffer size)
buff | buffer to check |
void ses_msg_clean_msgQ | ( | ses_cb_t * | scb | ) |
Clean all the input messages use by the scb Used by YP-COAP.
[in,out] | scb | session to use
|
void ses_msg_clean_outbuffs | ( | ses_cb_t * | scb | ) |
Clean the message out buffers for next use.
scb | == session control block |
void ses_msg_clean_tempchunkQ | ( | dlq_hdr_t * | tempchunkQ | ) |
Clean a Q of ses_msg_tempchunk_t structs.
tempchunkQ | == que to use |
void ses_msg_cleanup | ( | void | ) |
Cleanup the session message manager module data structures.
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
scb | session control block | |
[out] | len | address of return len
|
size_t ses_msg_copy_buff | ( | ses_msg_buff_t * | buff, |
xmlChar * | retbuff, | ||
size_t | retbuff_size | ||
) |
Copy the buffer data to another buffer.
buff | buffer to copy from |
retbuff | buffer to copy into |
retbuff_size | length of retbuff |
void ses_msg_dump | ( | log_debug_t | lvl, |
const ses_msg_t * | msg, | ||
const xmlChar * | text | ||
) |
Dump the message contents.
lvl | debug level for filtering. Output (if any) at LOG_DEBUG_WRITE. |
msg | message to dump |
text | start text before message dump (may be NULL) |
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
[in,out] | scb | session control block
|
ses_msg_buff_t * ses_msg_first_outbuff | ( | ses_cb_t * | scb | ) |
Get the first outQ buffer.
scb | session control block |
void ses_msg_free_buff | ( | ses_cb_t * | scb, |
ses_msg_buff_t * | buff | ||
) |
Free the session buffer chunk.
scb | session control block owning the message |
buff | buffer to free (already removed from any Q) |
Free the session message and all its buffer chunks.
scb | session control block owning the message |
msg | message to free (already removed from any Q) |
void ses_msg_free_tempchunk | ( | ses_msg_tempchunk_t * | tc | ) |
Free a temp chunk.
tc | tempchunk to delete |
ses_ready_t * ses_msg_get_first_inready | ( | boolean | ycontrol | ) |
Dequeue the first entry in the inreadyQ, if any.
ycontrol | TRUE if only YControl sessions should be processed FALSE to process any session type |
ses_ready_t * ses_msg_get_first_inready_ses | ( | ses_id_t | sid | ) |
Dequeue the first matching session entry in the inreadyQ, if any.
sid | first matching session entry in the inreadyQ or NULL if none |
ses_ready_t * ses_msg_get_first_outready | ( | void | ) |
Dequeue the first entry in the outreadyQ, if any.
ses_ready_t * ses_msg_get_first_outready_ycontrol | ( | void | ) |
Dequeue the first entry in the outreadyQ, if any Get a ycontrol entry.
xmlChar * ses_msg_get_onebuff | ( | ses_msg_t * | msg, |
xmlChar ** | retbuff, | ||
uint32 * | retlen | ||
) |
Get the entire message as 1 buffer.
Used by YANG-CBOR. Temp support since there is no 'reader' interface for CBOR code yet
One complete buffer will be created if needed
msg | session message to use | |
[out] | retbuff | address of returned malloced buff if needed
|
[out] | retlen | address of message length
|
void ses_msg_init | ( | void | ) |
Initialize the session message manager module data structures.
void ses_msg_init_buff | ( | ses_cb_t * | scb, |
boolean | outbuff, | ||
ses_msg_buff_t * | buff | ||
) |
Init the buffer fields.
scb | session control block |
outbuff | TRUE if oupput buffer; FALSE if input buffer |
buff | buffer to send |
boolean ses_msg_is_binary | ( | const ses_msg_t * | msg | ) |
Check if the message is a binary message Used by YANG-CBOR.
The first buffer will be checked to see if the isbinary flag is set.
msg | session message to check |
void ses_msg_make_inready | ( | ses_cb_t * | scb | ) |
Put the session on the inreadyQ if it is not already there.
[in,out] | scb | session control block
|
void ses_msg_make_outready | ( | ses_cb_t * | scb | ) |
Put the session on the outreadyQ if it is not already there.
[in,out] | scb | session control block
|
void ses_msg_make_outready_ycontrol | ( | ses_cb_t * | scb | ) |
Put the session on the outreadyQ if it is not already there.
[in,out] | scb | session control block
|
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
scb | session control block to malloc a new message for | |
outbuff | TRUE if this is for outgoing message FALSE if this is for incoming message | |
[out] | buff | address of ses_msg_buff_t pointer that will be set
|
Malloc a new session message control header.
[out] | msg | address of ses_msg_t pointer that will be set
|
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
[in,out] | scb | session control block
|
start_chunk_mode | TRUE if http_chunk_mode should be started before the next buffer is allocated |
ses_msg_tempchunk_t * ses_msg_new_tempchunk | ( | xmlChar * | chunk, |
uint32 | chunklen | ||
) |
Create a new temp chunk.
chunk | chunk to store (memory passed off here) |
chunklen | byte length of chunk |
ses_msg_buff_t * ses_msg_next_outbuff | ( | ses_cb_t * | scb, |
ses_msg_buff_t * | curbuff | ||
) |
Get the next outQ buffer.
scb | session control block |
curbuff | current buffer |
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.
scb | session control block to use |
msg | message to change |
tempchunkQ | Q of ses_msg_tempchunk_t structs |
Send multiple buffers to the session client socket Tries to send one packet at maximum MTU.
scb | session control block | |
[out] | anyout | address of return output flag (may be NULL)
|
uint32 ses_msg_size_tempchunkQ | ( | dlq_hdr_t * | tempchunkQ | ) |
Get the size of the message in the tempchunks.
tempchunkQ | que to use |
status_t ses_msg_write_buff | ( | ses_cb_t * | scb, |
ses_msg_buff_t * | buff, | ||
xmlChar | ch | ||
) |
Add some text to the message buffer.
scb | session control block to use |
buff | buffer to write to |
ch | xmlChar to write |