@@ -500,8 +500,6 @@ int nc_session_ntf_thread_running(const struct nc_session *session);
500500/**
501501 * @brief Receive NETCONF RPC reply.
502502 *
503- * @note This function can be called in a single thread only.
504- *
505503 * @param[in] session NETCONF session from which the function gets data. It must be the
506504 * client side session object.
507505 * @param[in] rpc Original RPC this should be the reply to.
@@ -575,6 +573,24 @@ int nc_recv_notif_dispatch(struct nc_session *session, nc_notif_dispatch_clb not
575573int nc_recv_notif_dispatch_data (struct nc_session * session , nc_notif_dispatch_clb notif_clb , void * user_data ,
576574 void (* free_data )(void * ));
577575
576+ /**
577+ * @brief Receive a reply message.
578+ *
579+ * Allows receiving raw NETCONF messages and does not perform any checks including message-id matching.
580+ * For all valid messages, ::nc_recv_reply() should be used instead.
581+ *
582+ * @param[in] session NETCONF session from which the function gets data. It must be the
583+ * client side session object.
584+ * @param[in] timeout Timeout for reading in milliseconds. Use negative value for infinite
585+ * waiting and 0 for immediate return if data are not available on the wire.
586+ * @param[out] msg Received message as a string.
587+ * @return #NC_MSG_REPLY for success,
588+ * #NC_MSG_WOULDBLOCK if @p timeout has elapsed,
589+ * #NC_MSG_ERROR if reading has failed,
590+ * #NC_MSG_NOTIF if a notification was read instead (call this function again to get the reply).
591+ */
592+ int nc_recv_msg (struct nc_session * session , int timeout , char * * msg );
593+
578594/**
579595 * @brief Send NETCONF RPC message via the session.
580596 *
@@ -589,6 +605,24 @@ int nc_recv_notif_dispatch_data(struct nc_session *session, nc_notif_dispatch_cl
589605 */
590606NC_MSG_TYPE nc_send_rpc (struct nc_session * session , struct nc_rpc * rpc , int timeout , uint64_t * msgid );
591607
608+ /**
609+ * @brief Send a message via the session.
610+ *
611+ * Allows for sending arbitrary NETCONF-encoded messages. For all valid messages, ::nc_send_rpc() should be used
612+ * instead.
613+ *
614+ * @param[in] session NETCONF session where the RPC will be written.
615+ * @param[in] msg Message (XML-encoded) to send.
616+ * @param[in] msg_len Length of @p msg. May be 0 if it is 0-terminated.
617+ * @param[in] timeout Timeout for writing in milliseconds. Use negative value for infinite
618+ * waiting and 0 for return if data cannot be sent immediately.
619+ * @param[out] msgid Optional, if RPC was successfully sent, this is it's message ID.
620+ * @return #NC_MSG_RPC on success,
621+ * #NC_MSG_WOULDBLOCK in case of a busy session, and
622+ * #NC_MSG_ERROR on error.
623+ */
624+ NC_MSG_TYPE nc_send_msg (struct nc_session * session , const char * msg , uint32_t msg_len , int timeout , uint64_t * msgid );
625+
592626/**
593627 * @brief Make a session not strict when sending RPCs and receiving RPC replies. In other words,
594628 * it will silently skip unknown nodes without an error.
0 commit comments