yumapro  23.10T-6
YumaPro SDK
Loading...
Searching...
No Matches
ses_msg.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008 - 2012, Andy Bierman, All Rights Reserved.
3 * Copyright (c) 2012 - 2021, YumaWorks, Inc., All Rights Reserved.
4 *
5 * Unless required by applicable law or agreed to in writing,
6 * software distributed under the License is distributed on an
7 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8 * KIND, either express or implied. See the License for the
9 * specific language governing permissions and limitations
10 * under the License.
11 */
12#ifndef _H_ses_msg
13#define _H_ses_msg
14/* FILE: ses_msg.h
15*********************************************************************
16* *
17* P U R P O S E *
18* *
19*********************************************************************/
20
27/*********************************************************************
28* *
29* C H A N G E H I S T O R Y *
30* *
31*********************************************************************
32
33date init comment
34----------------------------------------------------------------------
3520-jan-07 abb Begun.
36*/
37
38#include <xmlstring.h>
39#include <xmlreader.h>
40
41#ifndef _H_dlq
42#include "dlq.h"
43#endif
44
45#ifndef _H_log
46#include "log.h"
47#endif
48
49#ifndef _H_ses
50#include "ses.h"
51#endif
52
53#ifdef __cplusplus
54extern "C" {
55#endif
56
57/********************************************************************
58* *
59* C O N S T A N T S *
60* *
61*********************************************************************/
62
63
64
65/********************************************************************
66* *
67* T Y P E S *
68* *
69*********************************************************************/
70
82typedef struct ses_msg_tempchunk_t_ {
83 dlq_hdr_t qhdr;
84 xmlChar *chunk;
85 uint32 chunklen;
87
88
89
90/********************************************************************
91* *
92* F U N C T I O N S *
93* *
94*********************************************************************/
95
96
101extern void
102 ses_msg_init (void);
103
104
105
110extern void
111 ses_msg_cleanup (void);
112
113
121extern status_t
123
124
131extern void
133 ses_msg_t *msg);
134
135
149extern status_t
151 boolean outbuff,
152 ses_msg_buff_t **buff);
153
154
161extern void
163 ses_msg_buff_t *buff);
164
165
174extern status_t
176 ses_msg_buff_t *buff,
177 xmlChar ch);
178
179
190extern status_t
192 boolean *anyout);
193
194
209extern status_t
211 boolean start_chunk_mode);
212
213
220extern void
222
223
230extern void
232
233
240extern void
242
243
252extern void
254
255
263extern ses_ready_t *
264 ses_msg_get_first_inready (boolean ycontrol);
265
266
272extern ses_ready_t *
274
275
281extern ses_ready_t *
283
284
291extern ses_ready_t *
293
294
302extern void
304 const ses_msg_t *msg,
305 const xmlChar *text);
306
307
316 extern void
318 ses_msg_buff_t *buff);
319
320
328extern void
330 boolean outbuff,
331 ses_msg_buff_t *buff);
332
333
345extern status_t
347 ses_msg_t *msg,
348 dlq_hdr_t *tempchunkQ);
349
350
358extern ses_msg_tempchunk_t *
359 ses_msg_new_tempchunk (xmlChar *chunk,
360 uint32 chunklen);
361
362
368extern void
370
371
377extern void
378 ses_msg_clean_tempchunkQ (dlq_hdr_t *tempchunkQ);
379
380
387extern uint32
388 ses_msg_size_tempchunkQ (dlq_hdr_t *tempchunkQ);
389
390
397extern ses_msg_buff_t *
399
400
408extern ses_msg_buff_t *
410 ses_msg_buff_t *curbuff);
411
412
419extern size_t
421
422
431extern size_t
433 xmlChar *retbuff,
434 size_t retbuff_size);
435
436
442extern void
444
445
457extern xmlChar *
459 uint32 *len);
460
461
475extern status_t
477 xmlChar *data,
478 size_t datalen);
479
487extern void
489
490
501extern boolean
502 ses_msg_is_binary (const ses_msg_t *msg);
503
504
521extern xmlChar *
523 xmlChar **retbuff,
524 uint32 *retlen);
525
526
530#ifdef __cplusplus
531} /* end extern 'C' */
532#endif
533
534#endif /* _H_ses_msg */
dlq provides general double-linked list and queue support:
log_debug_t
The debug level enumerations used in util/log.c.
Definition: log.h:343
status_t
global error return code
Definition: status_enum.h:210
uint32 ses_id_t
Session ID.
Definition: ses.h:335
ses_msg_buff_t * ses_msg_next_outbuff(ses_cb_t *scb, ses_msg_buff_t *curbuff)
Get the next outQ buffer.
Definition: ses_msg.c:1636
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.
Definition: ses_msg.c:1253
void ses_msg_init_buff(ses_cb_t *scb, boolean outbuff, ses_msg_buff_t *buff)
Init the buffer fields.
Definition: ses_msg.c:1352
void ses_msg_clean_tempchunkQ(dlq_hdr_t *tempchunkQ)
Clean a Q of ses_msg_tempchunk_t structs.
Definition: ses_msg.c:1556
size_t ses_msg_copy_buff(ses_msg_buff_t *buff, xmlChar *retbuff, size_t retbuff_size)
Copy the buffer data to another buffer.
Definition: ses_msg.c:1687
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.
Definition: ses_msg.c:590
ses_ready_t * ses_msg_get_first_inready(boolean ycontrol)
Dequeue the first entry in the inreadyQ, if any.
Definition: ses_msg.c:1039
size_t ses_msg_buff_size(ses_msg_buff_t *buff)
Get the number of bytes in the buffer (not the buffer size)
Definition: ses_msg.c:1661
void ses_msg_finish_outmsg(ses_cb_t *scb)
Put the outbuff in the outQ if non-empty.
Definition: ses_msg.c:973
uint32 ses_msg_size_tempchunkQ(dlq_hdr_t *tempchunkQ)
Get the size of the message in the tempchunks.
Definition: ses_msg.c:1581
ses_ready_t * ses_msg_get_first_outready(void)
Dequeue the first entry in the outreadyQ, if any.
Definition: ses_msg.c:1112
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.
Definition: ses_msg.c:1388
ses_ready_t * ses_msg_get_first_outready_ycontrol(void)
Dequeue the first entry in the outreadyQ, if any Get a ycontrol entry.
Definition: ses_msg.c:1139
void ses_msg_free_buff(ses_cb_t *scb, ses_msg_buff_t *buff)
Free the session buffer chunk.
Definition: ses_msg.c:480
status_t ses_msg_new_msg(ses_msg_t **msg)
Malloc a new session message control header.
Definition: ses_msg.c:299
void ses_msg_make_outready_ycontrol(ses_cb_t *scb)
Put the session on the outreadyQ if it is not already there.
Definition: ses_msg.c:946
status_t ses_msg_new_buff(ses_cb_t *scb, boolean outbuff, ses_msg_buff_t **buff)
Malloc a new session buffer chuck.
Definition: ses_msg.c:397
void ses_msg_free_tempchunk(ses_msg_tempchunk_t *tc)
Free a temp chunk.
Definition: ses_msg.c:1535
void ses_msg_cleanup(void)
Cleanup the session message manager module data structures.
Definition: ses_msg.c:260
void ses_msg_free_msg(ses_cb_t *scb, ses_msg_t *msg)
Free the session message and all its buffer chunks.
Definition: ses_msg.c:345
void ses_msg_clean_msgQ(ses_cb_t *scb)
Clean all the input messages use by the scb Used by YP-COAP.
Definition: ses_msg.c:1886
ses_msg_tempchunk_t * ses_msg_new_tempchunk(xmlChar *chunk, uint32 chunklen)
Create a new temp chunk.
Definition: ses_msg.c:1511
boolean ses_msg_is_binary(const ses_msg_t *msg)
Check if the message is a binary message Used by YANG-CBOR.
Definition: ses_msg.c:1912
status_t ses_msg_new_output_buff(ses_cb_t *scb, boolean start_chunk_mode)
Put the current outbuff on the outQ.
Definition: ses_msg.c:829
void ses_msg_make_inready(ses_cb_t *scb)
Put the session on the inreadyQ if it is not already there.
Definition: ses_msg.c:894
void ses_msg_dump(log_debug_t lvl, const ses_msg_t *msg, const xmlChar *text)
Dump the message contents.
Definition: ses_msg.c:1168
ses_ready_t * ses_msg_get_first_inready_ses(ses_id_t sid)
Dequeue the first matching session entry in the inreadyQ, if any.
Definition: ses_msg.c:1073
ses_msg_buff_t * ses_msg_first_outbuff(ses_cb_t *scb)
Get the first outQ buffer.
Definition: ses_msg.c:1612
status_t ses_msg_write_buff(ses_cb_t *scb, ses_msg_buff_t *buff, xmlChar ch)
Add some text to the message buffer.
Definition: ses_msg.c:543
void ses_msg_make_outready(ses_cb_t *scb)
Put the session on the outreadyQ if it is not already there.
Definition: ses_msg.c:920
xmlChar * ses_msg_convert_outbuffs(ses_cb_t *scb, uint32 *len)
Clean the message out buffers for next use.
Definition: ses_msg.c:1762
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 inp...
Definition: ses_msg.c:1830
void ses_msg_init(void)
Initialize the session message manager module data structures.
Definition: ses_msg.c:236
void ses_msg_clean_outbuffs(ses_cb_t *scb)
Clean the message out buffers for next use.
Definition: ses_msg.c:1721
xmlChar * ses_msg_get_onebuff(ses_msg_t *msg, xmlChar **retbuff, uint32 *retlen)
Get the entire message as 1 buffer.
Definition: ses_msg.c:1946
NCX System Logging Manager.
NETCONF Session Common definitions module.
Session Control Block.
Definition: ses.h:573
Session Message Buffer.
Definition: ses.h:500
Session Message.
Definition: ses.h:535
save the chunks before putting them back into ses_buff_t structs
Definition: ses_msg.h:82
xmlChar * chunk
chunk
Definition: ses_msg.h:84
dlq_hdr_t qhdr
queue header
Definition: ses_msg.h:83
uint32 chunklen
chunk length
Definition: ses_msg.h:85
embedded Q header for the message ready Q The 'inq' flag is used to prevent queue corruption
Definition: ses.h:519