libnetconf 0.10.0-0.10.0
NETCONF Library
Loading...
Searching...
No Matches
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
47extern "C" {
48#endif
49
70struct nc_session* nc_session_dummy(const char* sid, const char* username, const char* hostname, struct nc_cpblts *capabilities);
71
79int nc_session_monitor(struct nc_session* session);
80
91void nc_session_free(struct nc_session* session);
92
99NC_SESSION_STATUS nc_session_get_status(const struct nc_session* session);
100
107int nc_session_get_version(const struct nc_session* session);
108
120int nc_session_get_eventfd(const struct nc_session* session);
121
128const char* nc_session_get_id(const struct nc_session* session);
129
136const char* nc_session_get_host(const struct nc_session* session);
137
144const char* nc_session_get_port(const struct nc_session* session);
145
152const char* nc_session_get_user(const struct nc_session* session);
153
160NC_TRANSPORT nc_session_get_transport(const struct nc_session* session);
161
168int nc_session_notif_allowed(struct nc_session *session);
169
180struct nc_cpblts* nc_session_get_cpblts(const struct nc_session* session);
181
189struct nc_cpblts *nc_cpblts_new(const char* const list[]);
190
199void nc_cpblts_free(struct nc_cpblts *c);
200
211int nc_cpblts_add(struct nc_cpblts *capabilities, const char* capability_string);
212
223int nc_cpblts_remove(struct nc_cpblts *capabilities, const char* capability_string);
224
233int nc_cpblts_enabled(const struct nc_session* session, const char* capability_string);
234
244const char* nc_cpblts_get(const struct nc_cpblts *c, const char* capability_string);
245
254void nc_cpblts_iter_start(struct nc_cpblts *c);
255
268const char *nc_cpblts_iter_next(struct nc_cpblts *c);
269
279int nc_cpblts_count(const struct nc_cpblts *c);
280
292struct nc_cpblts *nc_session_get_cpblts_default(void);
293
305const nc_msgid nc_session_send_rpc(struct nc_session* session, nc_rpc *rpc);
306
319const nc_msgid nc_session_send_reply(struct nc_session* session, const nc_rpc* rpc, const nc_reply *reply);
320
329int nc_session_send_notif(struct nc_session* session, const nc_ntf* ntf);
330
346NC_MSG_TYPE nc_session_recv_rpc(struct nc_session* session, int timeout, nc_rpc** rpc);
347
370NC_MSG_TYPE nc_session_recv_reply(struct nc_session* session, int timeout, nc_reply** reply);
371
390NC_MSG_TYPE nc_session_recv_notif(struct nc_session* session, int timeout, nc_ntf** ntf);
391
400int nc_msgid_compare(const nc_msgid id1, const nc_msgid id2);
401
415NC_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_ */
NC_MSG_TYPE
Enumeration of NETCONF message types.
Definition netconf.h:136
int nc_msgid_compare(const nc_msgid id1, const nc_msgid id2)
Compare two message IDs if they are the same.
int nc_session_send_notif(struct nc_session *session, const nc_ntf *ntf)
Send <notification> message from server to client.
struct nc_msg nc_ntf
Event notification message.
Definition netconf.h:68
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 ...
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 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...
struct nc_msg nc_reply
reply message.
Definition netconf.h:62
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...
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.
struct nc_msg nc_rpc
rpc message.
Definition netconf.h:56
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_monitor(struct nc_session *session)
Add the session into the internal list of monitored sessions that are returned as part of netconf-sta...
const char * nc_session_get_port(const struct nc_session *session)
Get NETCONF session port number.
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.
struct nc_cpblts * nc_session_get_cpblts(const struct nc_session *session)
Get list of capabilities associated with the session.
struct nc_cpblts * nc_cpblts_new(const char *const list[])
Create a new NETCONF capabilities structure.
int nc_cpblts_add(struct nc_cpblts *capabilities, const char *capability_string)
Add another capability string into the NETCONF capabilities structure.
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...
void nc_cpblts_free(struct nc_cpblts *c)
Free NETCONF capabilities structure.
const char * nc_cpblts_iter_next(struct nc_cpblts *c)
Get the next capability string from the given NETCONF capabilities structure.
int nc_cpblts_count(const struct nc_cpblts *c)
Get the number of capabilities in the structure.
const char * nc_session_get_user(const struct nc_session *session)
Get NETCONF session username.
int nc_session_get_eventfd(const struct nc_session *session)
Get the input file descriptor to asynchronous control of input events.
#define nc_msgid
Type representing NETCONF message-id attribute.
Definition netconf.h:91
NC_TRANSPORT
Supported NETCONF transport protocols enumeration. To change currently used transport protocol,...
Definition netconf.h:410
NC_SESSION_STATUS
Enumeration of the possible states of a NETCONF session.
Definition netconf.h:109
void nc_session_free(struct nc_session *session)
Cleanup the session structure and free all the allocated resources.
int nc_cpblts_enabled(const struct nc_session *session, const char *capability_string)
Check if the given capability is supported by the session.
const char * nc_session_get_host(const struct nc_session *session)
Get NETCONF session host.
const char * nc_cpblts_get(const struct nc_cpblts *c, const char *capability_string)
Get complete capability string including parameters.
const char * nc_session_get_id(const struct nc_session *session)
Get NETCONF session ID.
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.
NC_SESSION_STATUS nc_session_get_status(const struct nc_session *session)
Get information about the session current status.
void nc_cpblts_iter_start(struct nc_cpblts *c)
Move NETCONF capabilities structure iterator to the beginning of the capability strings list.
int nc_session_notif_allowed(struct nc_session *session)
Tell me if the notification subscription is allowed on the given session.
libnetconf's general public functions and structures definitions.
Functions implementing transport layer for NETCONF.