libnetconf  0.10.0-146_trunk
NETCONF Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
session.h
Go to the documentation of this file.
1 
40 #ifndef NC_SESSION_H_
41 #define NC_SESSION_H_
42 
43 #include "transport.h"
44 #include "netconf.h"
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
70 struct nc_session* nc_session_dummy(const char* sid, const char* username, const char* hostname, struct nc_cpblts *capabilities);
71 
79 int nc_session_monitor(struct nc_session* session);
80 
91 void nc_session_free(struct nc_session* session);
92 
99 NC_SESSION_STATUS nc_session_get_status(const struct nc_session* session);
100 
107 int nc_session_get_version(const struct nc_session* session);
108 
120 int nc_session_get_eventfd(const struct nc_session* session);
121 
128 const char* nc_session_get_id(const struct nc_session* session);
129 
136 const char* nc_session_get_host(const struct nc_session* session);
137 
144 const char* nc_session_get_port(const struct nc_session* session);
145 
152 const char* nc_session_get_user(const struct nc_session* session);
153 
160 NC_TRANSPORT nc_session_get_transport(const struct nc_session* session);
161 
168 int nc_session_notif_allowed(struct nc_session *session);
169 
180 struct nc_cpblts* nc_session_get_cpblts(const struct nc_session* session);
181 
189 struct nc_cpblts *nc_cpblts_new(const char* const list[]);
190 
199 void nc_cpblts_free(struct nc_cpblts *c);
200 
211 int nc_cpblts_add(struct nc_cpblts *capabilities, const char* capability_string);
212 
223 int nc_cpblts_remove(struct nc_cpblts *capabilities, const char* capability_string);
224 
233 int nc_cpblts_enabled(const struct nc_session* session, const char* capability_string);
234 
244 const char* nc_cpblts_get(const struct nc_cpblts *c, const char* capability_string);
245 
254 void nc_cpblts_iter_start(struct nc_cpblts *c);
255 
268 const char *nc_cpblts_iter_next(struct nc_cpblts *c);
269 
279 int nc_cpblts_count(const struct nc_cpblts *c);
280 
292 struct nc_cpblts *nc_session_get_cpblts_default(void);
293 
305 const nc_msgid nc_session_send_rpc(struct nc_session* session, nc_rpc *rpc);
306 
319 const nc_msgid nc_session_send_reply(struct nc_session* session, const nc_rpc* rpc, const nc_reply *reply);
320 
329 int nc_session_send_notif(struct nc_session* session, const nc_ntf* ntf);
330 
346 NC_MSG_TYPE nc_session_recv_rpc(struct nc_session* session, int timeout, nc_rpc** rpc);
347 
370 NC_MSG_TYPE nc_session_recv_reply(struct nc_session* session, int timeout, nc_reply** reply);
371 
390 NC_MSG_TYPE nc_session_recv_notif(struct nc_session* session, int timeout, nc_ntf** ntf);
391 
400 int nc_msgid_compare(const nc_msgid id1, const nc_msgid id2);
401 
415 NC_MSG_TYPE nc_session_send_recv(struct nc_session* session, nc_rpc *rpc, nc_reply** reply);
416 
417 #ifdef __cplusplus
418 }
419 #endif
420 
421 #endif /* NC_SESSION_H_ */
const char * nc_cpblts_iter_next(struct nc_cpblts *c)
Get the next capability string from the given NETCONF capabilities structure.
NC_TRANSPORT
Supported NETCONF transport protocols enumeration. To change currently used transport protocol...
Definition: netconf.h:410
void nc_cpblts_free(struct nc_cpblts *c)
Free NETCONF capabilities structure.
int nc_session_monitor(struct nc_session *session)
Add the session into the internal list of monitored sessions that are returned as part of netconf-sta...
void nc_cpblts_iter_start(struct nc_cpblts *c)
Move NETCONF capabilities structure iterator to the beginning of the capability strings list...
Functions implementing transport layer for NETCONF.
NC_MSG_TYPE nc_session_recv_notif(struct nc_session *session, int timeout, nc_ntf **ntf)
Receive a <notification> message from the specified NETCONF session. This function is supposed to be ...
struct nc_cpblts * nc_session_get_cpblts(const struct nc_session *session)
Get list of capabilities associated with the session.
NC_TRANSPORT nc_session_get_transport(const struct nc_session *session)
Get transport protocol used for the NETCONF session.
struct nc_session * nc_session_dummy(const char *sid, const char *username, const char *hostname, struct nc_cpblts *capabilities)
Create a disconnected session structure.
int nc_msgid_compare(const nc_msgid id1, const nc_msgid id2)
Compare two message IDs if they are the same.
int nc_cpblts_add(struct nc_cpblts *capabilities, const char *capability_string)
Add another capability string into the NETCONF capabilities structure.
NC_SESSION_STATUS
Enumeration of the possible states of a NETCONF session.
Definition: netconf.h:109
struct nc_msg nc_reply
reply message.
Definition: netconf.h:62
int nc_cpblts_enabled(const struct nc_session *session, const char *capability_string)
Check if the given capability is supported by the session.
NC_SESSION_STATUS nc_session_get_status(const struct nc_session *session)
Get information about the session current status.
int nc_session_send_notif(struct nc_session *session, const nc_ntf *ntf)
Send <notification> message from server to client.
int nc_session_notif_allowed(struct nc_session *session)
Tell me if the notification subscription is allowed on the given session.
struct nc_msg nc_ntf
Event notification message.
Definition: netconf.h:68
struct nc_cpblts * nc_session_get_cpblts_default(void)
Get NULL terminated list of the default capabilities supported by libnetconf including the list of na...
int nc_cpblts_count(const struct nc_cpblts *c)
Get the number of capabilities in the structure.
const nc_msgid nc_session_send_rpc(struct nc_session *session, nc_rpc *rpc)
Send <rpc> request via specified NETCONF session. This function is supposed to be performed only by N...
int nc_session_get_eventfd(const struct nc_session *session)
Get the input file descriptor to asynchronous control of input events.
struct nc_cpblts * nc_cpblts_new(const char *const list[])
Create a new NETCONF capabilities structure.
struct nc_msg nc_rpc
rpc message.
Definition: netconf.h:56
const nc_msgid nc_session_send_reply(struct nc_session *session, const nc_rpc *rpc, const nc_reply *reply)
Send <rpc-reply> response via specified NETCONF session. This function is supposed to be performed on...
NC_MSG_TYPE
Enumeration of NETCONF message types.
Definition: netconf.h:136
const char * nc_cpblts_get(const struct nc_cpblts *c, const char *capability_string)
Get complete capability string including parameters.
NC_MSG_TYPE nc_session_recv_reply(struct nc_session *session, int timeout, nc_reply **reply)
Receive <rpc-reply> response from the specified NETCONF session. This function is supposed to be perf...
int nc_session_get_version(const struct nc_session *session)
Get NETCONF protocol version used in the given session.
int nc_cpblts_remove(struct nc_cpblts *capabilities, const char *capability_string)
Remove the specified capability string from the NETCONF capabilities structure.
const char * nc_session_get_port(const struct nc_session *session)
Get NETCONF session port number.
#define nc_msgid
Type representing NETCONF message-id attribute.
Definition: netconf.h:91
void nc_session_free(struct nc_session *session)
Cleanup the session structure and free all the allocated resources.
NC_MSG_TYPE nc_session_send_recv(struct nc_session *session, nc_rpc *rpc, nc_reply **reply)
Send <rpc> and receive <rpc-reply> via the specified NETCONF session.
libnetconf's general public functions and structures definitions.
const char * nc_session_get_user(const struct nc_session *session)
Get NETCONF session username.
NC_MSG_TYPE nc_session_recv_rpc(struct nc_session *session, int timeout, nc_rpc **rpc)
Receive <rpc> request from the specified NETCONF session. This function is supposed to be performed o...
const char * nc_session_get_id(const struct nc_session *session)
Get NETCONF session ID.
const char * nc_session_get_host(const struct nc_session *session)
Get NETCONF session host.