yumapro  24.10-3
YumaPro SDK
Loading...
Searching...
No Matches
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...
 
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...
 

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

◆ ses_msg_add_framing()

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
[in,out]buffbuffer control block
  • buff->buff has framing chars added

◆ ses_msg_add_input_msg()

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
[in,out]scbsession to use
  • scb->msgQ has message created and added
datacoap message body
datalencoap message body length
Returns
status
Here is the call graph for this function:

◆ ses_msg_buff_size()

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:

◆ ses_msg_clean_msgQ()

void ses_msg_clean_msgQ ( ses_cb_t scb)

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

Parameters
[in,out]scbsession to use
  • scb->msgQ cleaned
Here is the call graph for this function:

◆ ses_msg_clean_outbuffs()

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:

◆ ses_msg_clean_tempchunkQ()

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:

◆ ses_msg_cleanup()

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:

◆ ses_msg_convert_outbuffs()

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
[out]lenaddress of return len
  • *len number of bytes in return buffer
Returns
malloced buffer containing all outbuff content
Here is the call graph for this function:

◆ ses_msg_copy_buff()

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:

◆ ses_msg_dump()

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:

◆ ses_msg_finish_outmsg()

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
[in,out]scbsession control block
  • scb->outready will be queued on the outreadyQ
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ses_msg_first_outbuff()

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

◆ ses_msg_free_buff()

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:

◆ ses_msg_free_msg()

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:

◆ ses_msg_free_tempchunk()

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_msg_get_first_inready()

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_msg_get_first_inready_ses()

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_msg_get_first_outready()

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_msg_get_first_outready_ycontrol()

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:

◆ ses_msg_get_onebuff()

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

Parameters
msgsession message to use
[out]retbuffaddress of returned malloced buff if needed
  • *retbuff malloced buffer if multiple buffers found and needed to be merged. MUST be freed with m__free.
  • If NULL then there is only 1 buffer and copy not needed
[out]retlenaddress of message length
  • *retlen length of the entire buffer
Returns
pointer to buffer to use
Here is the call graph for this function:

◆ ses_msg_init()

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:

◆ ses_msg_init_buff()

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:

◆ ses_msg_is_binary()

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.

Parameters
msgsession message to check
Returns
TRUE if binary message detected; FALSE if not

◆ ses_msg_make_inready()

void ses_msg_make_inready ( ses_cb_t scb)

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

Parameters
[in,out]scbsession control block
  • scb->inready will be queued on the inreadyQ
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ses_msg_make_outready()

void ses_msg_make_outready ( ses_cb_t scb)

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

Parameters
[in,out]scbsession control block
  • scb->outready will be queued on the outreadyQ
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ses_msg_make_outready_ycontrol()

void ses_msg_make_outready_ycontrol ( ses_cb_t scb)

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

Parameters
[in,out]scbsession control block
  • scb->outready will be queued on the outreadyQ
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ses_msg_new_buff()

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
[out]buffaddress of ses_msg_buff_t pointer that will be set
  • *buff malloced 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:

◆ ses_msg_new_msg()

status_t ses_msg_new_msg ( ses_msg_t **  msg)

Malloc a new session message control header.

Parameters
[out]msgaddress of ses_msg_t pointer that will be set
  • *msg malloced 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:

◆ ses_msg_new_output_buff()

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
[in,out]scbsession control block
  • scb->outbuff is filled in
  • scb->outready could be set
  • scb->outQ could be changed
start_chunk_modeTRUE if http_chunk_mode should be started before the next buffer is allocated
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_new_tempchunk()

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_next_outbuff()

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

◆ ses_msg_reset_message()

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:

◆ ses_msg_send_buffs()

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
[out]anyoutaddress of return output flag (may be NULL)
  • *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:

◆ ses_msg_size_tempchunkQ()

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

◆ ses_msg_write_buff()

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