FEATURE writing to NETCONF session
Writing reply and notification is not finished - higher level functions
are missing so the way to define what is going to be written is still
unclear even in the low level functions.
diff --git a/src/session.h b/src/session.h
index 742f2d4..086e1cd 100644
--- a/src/session.h
+++ b/src/session.h
@@ -23,6 +23,8 @@
#ifndef NC_SESSION_H_
#define NC_SESSION_H_
+#include <stdint.h>
+
#include "messages.h"
/**
@@ -31,18 +33,54 @@
struct nc_session;
/**
- * @brief Receive NETCONF RPC
+ * @brief Receive NETCONF RPC.
+ *
+ * @param[in] session NETCONF session from which the function gets data. It must be the
+ * server side session object.
+ * @param[in] timeout Timeout for reading in milliseconds. Use negative value for infinite
+ * waiting and 0 for immediate return if data are not available on wire.
+ * @param[out] notif Resulting object of NETCONF RPC.
+ * @return NC_MSG_RPC for success, NC_MSG_WOULDBLOCK if timeout reached and NC_MSG_ERROR
+ * when reading has failed.
*/
NC_MSG_TYPE nc_recv_rpc(struct nc_session* session, int timeout, struct nc_rpc **rpc);
/**
- * @brief Receive NETCONF RPC reply
+ * @brief Receive NETCONF RPC reply.
+ *
+ * @param[in] session NETCONF session from which the function gets data. It must be the
+ * client side session object.
+ * @param[in] timeout Timeout for reading in milliseconds. Use negative value for infinite
+ * waiting and 0 for immediate return if data are not available on wire.
+ * @param[out] reply Resulting object of NETCONF RPC reply.
+ * @return NC_MSG_REPLY for success, NC_MSG_WOULDBLOCK if timeout reached and NC_MSG_ERROR
+ * when reading has failed.
*/
NC_MSG_TYPE nc_recv_reply(struct nc_session* session, int timeout, struct nc_reply **reply);
/**
- * @brief Receive NETCONF Notification
+ * @brief Receive NETCONF Notification.
+ *
+ * @param[in] session NETCONF session from which the function gets data. It must be the
+ * client side session object.
+ * @param[in] timeout Timeout for reading in milliseconds. Use negative value for infinite
+ * waiting and 0 for immediate return if data are not available on wire.
+ * @param[out] notif Resulting object of NETCONF Notification.
+ * @return NC_MSG_NOTIF for success, NC_MSG_WOULDBLOCK if timeout reached and NC_MSG_ERROR
+ * when reading has failed.
*/
NC_MSG_TYPE nc_recv_notif(struct nc_session* session, int timeout, struct nc_notif **notif);
+/**
+ * @brief Send NETCONF RPC message via the session.
+ *
+ * @param[in] session NETCONF session where the RPC will be written.
+ * @param[in] op NETCONF RPC operation to be sent.
+ * @param[in] attrs Additional (optional) XML attributes to be added into the \<rpc\> element.
+ * Note, that "message-id" attribute is added automatically.
+ * @return #NC_MSG_RPC on success, #NC_MSG_WOULDBLOCK in case of busy session
+ * (try to repeat the function call) and #NC_MSG_ERROR in case of error.
+ */
+NC_MSG_TYPE nc_send_rpc(struct nc_session* session, struct lyd_node *op, const char *attrs);
+
#endif /* NC_SESSION_H_ */