yumapro  20.10-12
YumaPro SDK
ycontrol_ses.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_ycontrol_ses
13 #define _H_ycontrol_ses
14 
15 /* FILE: ycontrol_ses.h
16 *********************************************************************
17 * *
18 * P U R P O S E *
19 * *
20 *********************************************************************/
21 
22 
29 /*********************************************************************
30 * *
31 * C H A N G E H I S T O R Y *
32 * *
33 *********************************************************************
34 
35 date init comment
36 ----------------------------------------------------------------------
37 02-apr-14 abb Begun; adapted from mgr_ses.c
38 */
39 
40 #include <time.h>
41 #include <sys/time.h>
42 
43 #ifndef _H_status_enum
44 #include "status_enum.h"
45 #endif
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
51 /********************************************************************
52 * *
53 * C O N S T A N T S *
54 * *
55 *********************************************************************/
56 
57 
58 /********************************************************************
59 * *
60 * T Y P E S *
61 * *
62 *********************************************************************/
63 
64 
65 /********************************************************************
66 * *
67 * F U N C T I O N S *
68 * *
69 *********************************************************************/
70 
71 
93 extern status_t
94  ycontrol_ses_init (ycontrol_profile_t *profile);
95 
96 
102 extern void
103  ycontrol_ses_cleanup (ycontrol_profile_t *profile);
104 
105 
112 extern status_t
113  ycontrol_ses_attempt_connect (ycontrol_profile_t *profile);
114 
115 
122 extern void
123  ycontrol_ses_free_session (ycontrol_profile_t *profile,
124  ses_id_t sid);
125 
126 
134 extern boolean
135  ycontrol_ses_process_first_ready (ycontrol_profile_t *profile);
136 
137 
147 extern ses_cb_t *
148  ycontrol_ses_get_first_outready (ycontrol_profile_t *profile);
149 
150 
151 
155 #ifdef __cplusplus
156 } /* end extern 'C' */
157 #endif
158 
159 #endif /* _H_ycontrol_ses */
ses.h
NETCONF Session Common definitions module.
ycontrol_ses_cleanup
void ycontrol_ses_cleanup(ycontrol_profile_t *profile)
Cleanup ycontrol session handler.
Definition: ycontrol_ses.c:269
ses_set_protocol
status_t ses_set_protocol(ses_cb_t *scb, ncx_protocol_t proto)
set the NETCONF protocol version in use
Definition: ses.c:3780
ERR_NCX_TIMEOUT
@ ERR_NCX_TIMEOUT
368
Definition: status_enum.h:411
YCONTROL_ST_CONNECTED
@ YCONTROL_ST_CONNECTED
active state, ready to receive requests and start service layers
Definition: ycontrol.h:239
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
ycontrol_io_activate_session
void ycontrol_io_activate_session(ycontrol_profile_t *profile, int fd)
Tell the IO manager to stop listening on the specified socket.
Definition: ycontrol_io.c:328
log_error
void log_error(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_ERROR log entry.
xml_util.h
XML Utilities.
status_enum.h
global error status code enumerations
ses_msg_get_first_inready
ses_ready_t * ses_msg_get_first_inready(boolean ycontrol)
Dequeue the first entry in the inreadyQ, if any.
Definition: ses_msg.c:971
ERR_NCX_CONNECT_FAILED
@ ERR_NCX_CONNECT_FAILED
315
Definition: status_enum.h:358
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.
Definition: ses_msg.c:834
ycontrol_ses_free_session
void ycontrol_ses_free_session(ycontrol_profile_t *profile, ses_id_t sid)
Free a real session control block.
Definition: ycontrol_ses.c:287
ncxconst.h
Contains NCX constants.
ses_msg_dump
void ses_msg_dump(log_debug_t lvl, const ses_msg_t *msg, const xmlChar *text)
Dump the message contents.
Definition: ses_msg.c:1100
ses_msg.h
NETCONF Session Message Common definitions module.
subsys_util.h
Thin client IO handler for YumaPro server (utility functions)
ses_id_t
uint32 ses_id_t
Session ID.
Definition: ses.h:306
log_info
void void void void void log_info(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_INFO log entry.
YCONTROL_ST_CONNECTING
@ YCONTROL_ST_CONNECTING
connecting to the server
Definition: ycontrol.h:233
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.
ycontrol_dispatch_msg
boolean ycontrol_dispatch_msg(ses_cb_t *scb)
Find the appropriate service handler and call it with the incoming message from the server.
Definition: ycontrol.c:1306
YCONTROL_ST_SHUTDOWN_REQ
@ YCONTROL_ST_SHUTDOWN_REQ
got an application shutdown request
Definition: ycontrol.h:242
NO_ERR
@ NO_ERR
000
Definition: status_enum.h:188
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
LOGDEBUG2
#define LOGDEBUG2
Check if at least log-level=debug2.
Definition: log.h:292
SES_TYP_YCONTROL
@ SES_TYP_YCONTROL
internal YControl session w/ subsystem
Definition: ses.h:322
SES_MODE_XML
@ SES_MODE_XML
XML mode.
Definition: ses.h:379
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
ERR_INTERNAL_MEM
@ ERR_INTERNAL_MEM
003
Definition: status_enum.h:193
ycontrol_service_start
void ycontrol_service_start(void)
Start the registered services.
Definition: ycontrol.c:1021
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.
Definition: ses_msg.c:325
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.
ses_set_protocols_requested
void ses_set_protocols_requested(ses_cb_t *scb, ncx_protocol_t proto)
set the NETCONF protocol versions requested
Definition: ses.c:3875
LOGINFO
#define LOGINFO
Check if at least log-level=info.
Definition: log.h:279
dlq_nextEntry
#define dlq_nextEntry(nodeP)
get the next queue entry after the current entry
Definition: dlq.h:265
ycontrol_io_deactivate_session
void ycontrol_io_deactivate_session(ycontrol_profile_t *profile, int fd)
Tell the IO manager to stop listening on the specified socket.
Definition: ycontrol_io.c:345
ycontrol_ses_init
status_t ycontrol_ses_init(ycontrol_profile_t *profile)
Setup the YControl session handler.
Definition: ycontrol_ses.c:244
SES_TRANSPORT_AFLOCAL
@ SES_TRANSPORT_AFLOCAL
ncxserver.sock AF_LOCAL socket – control msg
Definition: ses.h:342
NCX_PROTO_YCONTROL
@ NCX_PROTO_YCONTROL
YumaPro Internal Control 1.0.
Definition: ncxtypes.h:787
subsystem.h
Thin client IO handler for YumaPro server.
ses_new_scb
ses_cb_t * ses_new_scb(void)
Create a new session control block.
Definition: ses.c:2025
ycontrol_ses.h
YControl session handler.
SES_ST_SHUTDOWN_REQ
@ SES_ST_SHUTDOWN_REQ
session shutdown requested
Definition: ses.h:360
LOGDEBUG
#define LOGDEBUG
Check if at least log-level=debug.
Definition: log.h:287
YCONTROL_ST_CONNECT
@ YCONTROL_ST_CONNECT
need a socket connection to server
Definition: ycontrol.h:230
ycontrol_ses_attempt_connect
status_t ycontrol_ses_attempt_connect(ycontrol_profile_t *profile)
Attempt to connect to the server.
Definition: ycontrol_ses.c:189
xml_strcpy
uint32 xml_strcpy(xmlChar *copyTo, const xmlChar *copyFrom)
String copy for xmlChar.
Definition: xml_util.c:1486
dlq_firstEntry
#define dlq_firstEntry(listP)
get the first entry in the queue list
Definition: dlq.h:337
connect_subsystem_ycontrol
status_t connect_subsystem_ycontrol(int *retfd)
Connect the subsystem for YControl.
Definition: subsystem.c:1247
ycontrol.h
YumaPro Subsystem Control Protocol.
SES_MY_SID
#define SES_MY_SID(S)
get session-id
Definition: ses.h:105
ycontrol_io.h
YControl protocol Input Output Handler.
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.
Definition: ses_msg.c:378
ycontrol_ses_process_first_ready
boolean ycontrol_ses_process_first_ready(ycontrol_profile_t *profile)
Check the readyQ and process the first message, if any.
Definition: ycontrol_ses.c:320
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.
Definition: ses_msg.c:1071
ses_free_scb
void ses_free_scb(ses_cb_t *scb)
Free a session control block.
Definition: ses.c:2221
SES_ST_INIT
@ SES_ST_INIT
initialization state
Definition: ses.h:354
SES_CURMSG
#define SES_CURMSG(S)
get the session current message
Definition: ses.h:204
ycontrol_setup_reconnect
void ycontrol_setup_reconnect(void)
Setup the YControl profile to reconnect after the retry interval with the incoming message from the s...
Definition: ycontrol.c:1383
SES_INST_IDLE
@ SES_INST_IDLE
idle state
Definition: ses.h:368
ycontrol_ses_get_first_outready
ses_cb_t * ycontrol_ses_get_first_outready(ycontrol_profile_t *profile)
Get the first ses_msg outreadyQ entry.
Definition: ycontrol_ses.c:436
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