yumapro  20.10-12
YumaPro SDK
agt_ypcoap.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 - 2021, YumaWorks, Inc., All Rights Reserved.
3  *
4  * Unless required by applicable law or agreed to in writing,
5  * software distributed under the License is distributed on an
6  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
7  * KIND, either express or implied. See the License for the
8  * specific language governing permissions and limitations
9  * under the License.
10  */
11 #ifdef WITH_COAP
12 #ifndef _H_agt_ypcoap
13 #define _H_agt_ypcoap
14 /* FILE: agt_ypcoap.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 
33 date init comment
34 ----------------------------------------------------------------------
35 25-may-16 abb Begun.
36 */
37 
38 #ifndef _H_status_enum
39 #include "status_enum.h"
40 #endif
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 /********************************************************************
47 * *
48 * C O N S T A N T S *
49 * *
50 *********************************************************************/
51 
52 
53 /********************************************************************
54 * *
55 * T Y P E S *
56 * *
57 *********************************************************************/
58 
59 
60 /********************************************************************
61 * *
62 * F U N C T I O N S *
63 * *
64 *********************************************************************/
65 
66 
86 extern status_t
87  agt_ypcoap_init (void);
88 
89 
95 extern void
96  agt_ypcoap_cleanup (void);
97 
98 
105 extern void
106  agt_ypcoap_check_io (void);
107 
108 
112 #ifdef __cplusplus
113 } /* end extern 'C' */
114 #endif
115 
116 #endif // _H_agt_ypcoap
117 #endif // WITH_COAP
ses.h
NETCONF Session Common definitions module.
xml_strlen
uint32 xml_strlen(const xmlChar *str)
Get the String len for xmlChar.
Definition: xml_util.c:1406
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.
Definition: ses_msg.c:1778
cfg.h
xml_strncpy
uint32 xml_strncpy(xmlChar *copyTo, const xmlChar *copyFrom, uint32 maxlen)
String copy for xmlChar – checks for buffer overflow.
Definition: xml_util.c:1518
agt_restconf.h
IETF RESTCONF Protocol Message Handler.
agt_ses.h
Server Session Management.
xml_reset_reader_for_session
status_t xml_reset_reader_for_session(xmlInputReadCallback readfn, xmlInputCloseCallback closefn, void *context, xmlTextReaderPtr reader)
Reset the xmlTextReader for parsing the input of a NETCONF session.
Definition: xml_util.c:418
xml_strdup
xmlChar * xml_strdup(const xmlChar *copyFrom)
String duplicate for xmlChar.
Definition: xml_util.c:1553
LOG_DEBUG_DEBUG4
@ LOG_DEBUG_DEBUG4
debug level 4
Definition: log.h:397
log_error
void log_error(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_ERROR log entry.
xml_util.h
XML Utilities.
getcb.h
GET1 and GET2 Callback Support.
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)
Definition: ses_msg.c:1561
status_enum.h
global error status code enumerations
RESTCONF_CONTENT_ALL
@ RESTCONF_CONTENT_ALL
all descendant data nodes
Definition: yangapi.h:217
log_debug3
void void void void void void void void void void void log_debug3(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG3 log entry.
agt_ypcoap_init
status_t agt_ypcoap_init(void)
Initialize the agt_ypcoap module.
Definition: agt_ypcoap.c:2490
agt_ncxserver.h
NCX Server Transport and IO Library.
ERR_NCX_TOO_BIG
@ ERR_NCX_TOO_BIG
259
Definition: status_enum.h:300
dlq_lastEntry
#define dlq_lastEntry(listP)
get the last entry in the queue list
Definition: dlq.h:352
ERR_NCX_DUP_ENTRY
@ ERR_NCX_DUP_ENTRY
224
Definition: status_enum.h:263
ses_msg.h
NETCONF Session Message Common definitions module.
yangapi_new_rcb
yangapi_cb_t * yangapi_new_rcb(void)
Create a new YANG-API control block.
Definition: yangapi.c:317
dlq_insertAhead
void dlq_insertAhead(void *newP, void *nodeP)
insert the new queue entry before the current entry
Definition: dlq.c:447
log_debug2
void void void void void void void void void log_debug2(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG2 log entry.
NO_ERR
@ NO_ERR
000
Definition: status_enum.h:188
xpath.h
Schema and data model Xpath search support.
ses_read_cb
int ses_read_cb(void *context, char *buffer, int len)
The IO input front-end for the xmlTextReader parser read fn.
Definition: ses.c:3093
yangapi_get_method_name
const xmlChar * yangapi_get_method_name(yangapi_method_t method_enum)
Get the method name from its enum.
Definition: yangapi.c:537
xml_strndup
xmlChar * xml_strndup(const xmlChar *copyFrom, uint32 maxlen)
String duplicate for max N xmlChars.
Definition: xml_util.c:1663
log_debug4
void void void void void void void void void void void void void log_debug4(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG4 log entry.
ERR_NCX_OPERATION_FAILED
@ ERR_NCX_OPERATION_FAILED
274
Definition: status_enum.h:315
cfg_rwlock_release_all_locks
status_t cfg_rwlock_release_all_locks(thd_tcb_t *tcb)
Release all RWLOCKs recorded in TCB lock state structure.
Definition: cfg.c:675
LOGDEBUG2
#define LOGDEBUG2
Check if at least log-level=debug2.
Definition: log.h:292
dlq_createSQue
void dlq_createSQue(dlq_hdrT *queAddr)
create a static queue header
Definition: dlq.c:177
LOG_DEBUG_WARN
@ LOG_DEBUG_WARN
all errors + warnings
Definition: log.h:391
dlq_remove
void dlq_remove(void *nodeP)
remove the queue entry from its queue list entry MUST have been enqueued somehow before this function...
Definition: dlq.c:519
val_util.h
Value Node Utilities.
ERR_NCX_INVALID_VALUE
@ ERR_NCX_INVALID_VALUE
258
Definition: status_enum.h:299
agt_restconf_dispatch_ex
boolean agt_restconf_dispatch_ex(ses_cb_t *scb, boolean scb_is_static)
Dispatch an incoming RESTCONF request (Extended)
Definition: agt_restconf.c:2031
log_get_log_level
log_debug_t log_get_log_level(void)
Get the main log level.
Definition: log.c:3508
agt_ypcoap_cleanup
void agt_ypcoap_cleanup(void)
Cleanup the agt_ypcoap module.
Definition: agt_ypcoap.c:2580
ERR_INTERNAL_MEM
@ ERR_INTERNAL_MEM
003
Definition: status_enum.h:193
ERR_INTERNAL_INIT_SEQ
@ ERR_INTERNAL_INIT_SEQ
007
Definition: status_enum.h:197
get_error_string
const char * get_error_string(status_t res)
Get the error message for a specific internal error.
Definition: status.c:239
log_debug
void void void void void void void log_debug(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG log entry.
thd_module_db_unlock
status_t thd_module_db_unlock(thd_tcb_t *tcb)
Unlock (release access) to the module DB ("object tree").
Definition: thd.c:1453
dlq_count
unsigned int dlq_count(const dlq_hdrT *listP)
get the number of queue entries in the listP queue list
Definition: dlq.c:994
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.
Definition: ses_msg.c:1585
dlq_nextEntry
#define dlq_nextEntry(nodeP)
get the next queue entry after the current entry
Definition: dlq.h:265
agt.h
Multi-Protocol Network Management Server.
LOG_DEBUG_DEBUG2
@ LOG_DEBUG_DEBUG2
debug level 2
Definition: log.h:395
agt_restcmn.h
Common function for RESTCONF and YANG-API protocols.
YANGAPI_METHOD_NONE
@ YANGAPI_METHOD_NONE
not set
Definition: yangapi.h:116
ses_msg_first_outbuff
ses_msg_buff_t * ses_msg_first_outbuff(ses_cb_t *scb)
Get the first outQ buffer.
Definition: ses_msg.c:1516
NCX_MAX_NUMLEN
#define NCX_MAX_NUMLEN
max number len to use for static buffer allocation only
Definition: ncxconst.h:136
agt_ypcoap.h
Yuma Interface to libcoap data structures. Agent interface.
LOG_DEBUG_ERROR
@ LOG_DEBUG_ERROR
fatal + internal errors only
Definition: log.h:390
xml_strcmp
int xml_strcmp(const xmlChar *s1, const xmlChar *s2)
String compare for xmlChar.
Definition: xml_util.c:1746
LOGDEBUG4
#define LOGDEBUG4
Check if at least log-level=debug4.
Definition: log.h:302
YANGAPI_METHOD_POST
@ YANGAPI_METHOD_POST
POST method.
Definition: yangapi.h:120
LOGDEBUG
#define LOGDEBUG
Check if at least log-level=debug.
Definition: log.h:287
YANGAPI_METHOD_GET
@ YANGAPI_METHOD_GET
GET method.
Definition: yangapi.h:119
dlq_deque
void * dlq_deque(dlq_hdrT *listP)
remove the first queue node from the queue list
Definition: dlq.c:286
dlq_empty
#define dlq_empty(listP)
check if queue list is empty
Definition: dlq.h:367
thd.h
Thread support (for now limited to netconfd)
yangapi_free_rcb
void yangapi_free_rcb(yangapi_cb_t *rcb)
Free a YANGAPI control block.
Definition: yangapi.c:351
agt_get_profile
agt_profile_t * agt_get_profile(void)
Get the server profile struct.
Definition: agt.c:4118
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 inp...
Definition: ses_msg.c:1722
YANGAPI_METHOD_HEAD
@ YANGAPI_METHOD_HEAD
HEAD method.
Definition: yangapi.h:118
agt_ses_new_coap_session
ses_cb_t * agt_ses_new_coap_session(void)
Create a dummy CoAP session control block.
Definition: agt_ses.c:666
dlq_firstEntry
#define dlq_firstEntry(listP)
get the first entry in the queue list
Definition: dlq.h:337
agt_ncxserver_get_timer_tcb
thd_tcb_t * agt_ncxserver_get_timer_tcb(void)
Get the timer TCB to hijack for the YP-HA standby SCB.
Definition: agt_ncxserver.c:3364
YANGAPI_METHOD_PATCH
@ YANGAPI_METHOD_PATCH
PATCH method.
Definition: yangapi.h:122
LOG_DEBUG_DEBUG
@ LOG_DEBUG_DEBUG
debug level 1
Definition: log.h:394
LOG_DEBUG_DEBUG3
@ LOG_DEBUG_DEBUG3
debug level 3
Definition: log.h:396
ses_msg_clean_outbuffs
void ses_msg_clean_outbuffs(ses_cb_t *scb)
Clean the message out buffers for next use.
Definition: ses_msg.c:1617
LOG_DEBUG_INFO
@ LOG_DEBUG_INFO
all previous + user info trace
Definition: log.h:392
dlq_enque
void dlq_enque(REG void *newP, REG dlq_hdrT *listP)
add a queue node to the end of a queue list Add newP to listP
Definition: dlq.c:246
agt_ypcoap_check_io
void agt_ypcoap_check_io(void)
Check if any CoAP messages to process.
Definition: agt_ypcoap.c:2616
ERR_NCX_DATA_MISSING
@ ERR_NCX_DATA_MISSING
272
Definition: status_enum.h:313
AGT_SELECT_TIMEOUT_USEC
#define AGT_SELECT_TIMEOUT_USEC
number of microseconds for each select timeout set to 1/100th sec
Definition: agt.h:391
YANGAPI_METHOD_OPTIONS
@ YANGAPI_METHOD_OPTIONS
OPTIONS method.
Definition: yangapi.h:117
agt_ses_free_coap_session
void agt_ses_free_coap_session(ses_cb_t *scb)
Free a dummy CoAP session control block.
Definition: agt_ses.c:711
status.h
Global error messages for status code enumerations.
yangapi.h
YANG-API definitions (pre-RESTCONF)
YANGAPI_METHOD_PUT
@ YANGAPI_METHOD_PUT
PUT method.
Definition: yangapi.h:121
AGT_SELECT_TIMEOUT_SEC
#define AGT_SELECT_TIMEOUT_SEC
number of seconds for each select timeout
Definition: agt.h:387
LOGDEBUG3
#define LOGDEBUG3
Check if at least log-level=debug3.
Definition: log.h:297
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.
Definition: ses_msg.c:1538
YANGAPI_METHOD_DELETE
@ YANGAPI_METHOD_DELETE
DELETE method.
Definition: yangapi.h:123
xml_get_reader_for_session
status_t xml_get_reader_for_session(xmlInputReadCallback readfn, xmlInputCloseCallback closefn, void *context, xmlTextReaderPtr *reader)
Get a new xmlTextReader for parsing the input of a NETCONF session.
Definition: xml_util.c:378
thd_find_tcb_by_sid
thd_tcb_t * thd_find_tcb_by_sid(ses_id_t sid, boolean strict)
Lookup TCB by session ID.
Definition: thd.c:704