yumapro  25.10-1
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* F U N C T I O N S *
92* *
93*********************************************************************/
94
95
100extern void
101 ses_msg_init (void);
102
103
104
109extern void
110 ses_msg_cleanup (void);
111
112
120extern status_t
122
123
130extern void
132 ses_msg_t *msg);
133
134
148extern status_t
150 boolean outbuff,
151 ses_msg_buff_t **buff);
152
153
160extern void
162 ses_msg_buff_t *buff);
163
164
173extern status_t
175 ses_msg_buff_t *buff,
176 xmlChar ch);
177
178
189extern status_t
191 boolean *anyout);
192
193
208extern status_t
210 boolean start_chunk_mode);
211
212
219extern void
221
222
229extern void
231
232
239extern void
241
242
251extern void
253
254
262extern ses_ready_t *
263 ses_msg_get_first_inready (boolean ycontrol);
264
265
271extern ses_ready_t *
273
274
280extern ses_ready_t *
282
283
290extern ses_ready_t *
292
293
301extern void
303 const ses_msg_t *msg,
304 const xmlChar *text);
305
306
315 extern void
317 ses_msg_buff_t *buff);
318
319
327extern void
329 boolean outbuff,
330 ses_msg_buff_t *buff);
331
332
344extern status_t
346 ses_msg_t *msg,
347 dlq_hdr_t *tempchunkQ);
348
349
357extern ses_msg_tempchunk_t *
358 ses_msg_new_tempchunk (xmlChar *chunk,
359 uint32 chunklen);
360
361
367extern void
369
370
376extern void
377 ses_msg_clean_tempchunkQ (dlq_hdr_t *tempchunkQ);
378
379
386extern uint32
387 ses_msg_size_tempchunkQ (dlq_hdr_t *tempchunkQ);
388
389
396extern ses_msg_buff_t *
398
399
407extern ses_msg_buff_t *
409 ses_msg_buff_t *curbuff);
410
411
418extern size_t
420
421
430extern size_t
432 xmlChar *retbuff,
433 size_t retbuff_size);
434
435
441extern void
443
444
456extern xmlChar *
458 uint32 *len);
459
460
474extern status_t
476 xmlChar *data,
477 size_t datalen);
478
486extern void
488
489
500extern boolean
501 ses_msg_is_binary (const ses_msg_t *msg);
502
503
517extern boolean
518 ses_msg_is_json (const ses_msg_t *msg);
519
520
537extern xmlChar *
539 xmlChar **retbuff,
540 uint32 *retlen);
541
542
546#ifdef __cplusplus
547} /* end extern 'C' */
548#endif
549
550#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:348
status_t
global error return code
Definition: status_enum.h:219
uint32 ses_id_t
Session ID.
Definition: ses.h:407
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:1646
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:1259
void ses_msg_init_buff(ses_cb_t *scb, boolean outbuff, ses_msg_buff_t *buff)
Init the buffer fields.
Definition: ses_msg.c:1358
void ses_msg_clean_tempchunkQ(dlq_hdr_t *tempchunkQ)
Clean a Q of ses_msg_tempchunk_t structs.
Definition: ses_msg.c:1566
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:1697
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:594
ses_ready_t * ses_msg_get_first_inready(boolean ycontrol)
Dequeue the first entry in the inreadyQ, if any.
Definition: ses_msg.c:1045
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:1671
void ses_msg_finish_outmsg(ses_cb_t *scb)
Put the outbuff in the outQ if non-empty.
Definition: ses_msg.c:977
uint32 ses_msg_size_tempchunkQ(dlq_hdr_t *tempchunkQ)
Get the size of the message in the tempchunks.
Definition: ses_msg.c:1591
ses_ready_t * ses_msg_get_first_outready(void)
Dequeue the first entry in the outreadyQ, if any.
Definition: ses_msg.c:1118
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:1398
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:1145
void ses_msg_free_buff(ses_cb_t *scb, ses_msg_buff_t *buff)
Free the session buffer chunk.
Definition: ses_msg.c:484
status_t ses_msg_new_msg(ses_msg_t **msg)
Malloc a new session message control header.
Definition: ses_msg.c:303
boolean ses_msg_is_json(const ses_msg_t *msg)
Check if the message is a JSON message Used by api-session to dispatch to mgr_top_dispatch_json_msg.
Definition: ses_msg.c:1959
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:950
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:401
void ses_msg_free_tempchunk(ses_msg_tempchunk_t *tc)
Free a temp chunk.
Definition: ses_msg.c:1545
void ses_msg_cleanup(void)
Cleanup the session message manager module data structures.
Definition: ses_msg.c:264
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:349
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:1896
ses_msg_tempchunk_t * ses_msg_new_tempchunk(xmlChar *chunk, uint32 chunklen)
Create a new temp chunk.
Definition: ses_msg.c:1521
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:1925
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:833
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:898
void ses_msg_dump(log_debug_t lvl, const ses_msg_t *msg, const xmlChar *text)
Dump the message contents.
Definition: ses_msg.c:1174
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:1079
ses_msg_buff_t * ses_msg_first_outbuff(ses_cb_t *scb)
Get the first outQ buffer.
Definition: ses_msg.c:1622
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:547
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:924
xmlChar * ses_msg_convert_outbuffs(ses_cb_t *scb, uint32 *len)
Clean the message out buffers for next use.
Definition: ses_msg.c:1772
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:1840
void ses_msg_init(void)
Initialize the session message manager module data structures.
Definition: ses_msg.c:240
void ses_msg_clean_outbuffs(ses_cb_t *scb)
Clean the message out buffers for next use.
Definition: ses_msg.c:1731
xmlChar * ses_msg_get_onebuff(ses_msg_t *msg, xmlChar **retbuff, uint32 *retlen)
Get the entire message as 1 buffer.
Definition: ses_msg.c:2003
NCX System Logging Manager.
NETCONF Session Common definitions module.
Session Control Block.
Definition: ses.h:759
Session Message Buffer.
Definition: ses.h:577
Session Message.
Definition: ses.h:623
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:607