DTNMA Reference Tools v2.1.0 - 13.gc5c0bac
Delay-Tolerant Networking Management Architecture (DTNMA) Tool Suite
Loading...
Searching...
No Matches
proxy_msg.c File Reference
#include "proxy_msg.h"
#include "cace/ari/cbor.h"
#include "cace/ari/text.h"
#include "cace/util/logging.h"
#include "cace/util/defs.h"
#include <qcbor/qcbor.h>
#include <sys/socket.h>
#include <errno.h>
+ Include dependency graph for proxy_msg.c:

Functions

int cace_amp_proxy_msg_send (int sock_fd, const cace_ari_t *dst, const uint8_t *data_ptr, size_t data_len)
 Send a message via datagram socket proxy to an ultimate destination.
 
int cace_amp_proxy_msg_recv (int sock_fd, cace_ari_t *src, m_bstring_t data)
 Receive a message via datagram socket proxy from an ultimate source.
 

Function Documentation

◆ cace_amp_proxy_msg_recv()

int cace_amp_proxy_msg_recv ( int  sock_fd,
cace_ari_t src,
m_bstring_t  data 
)

Receive a message via datagram socket proxy from an ultimate source.

Parameters
sock_fdThe socket file descriptor. The socket must be ready for reading (e.g. determined via poll() and POLLIN event) before this call.
[out]srcThe ultimate source endpoint being received from.
[out]dataThe data to populate, which must already be initialized.
Returns
Zero if successful, non-zero if reception is no longer possible.

References cace_ari_cbor_decode(), CACE_ARI_TEXT_ENC_OPTS_DEFAULT, cace_ari_text_encode(), cace_data_deinit(), cace_data_init_view(), CACE_LOG_ERR, CACE_LOG_INFO, cace_log_is_enabled_for(), CACE_LOG_WARNING, CHKERR1, and result.

Referenced by sock_worker().

◆ cace_amp_proxy_msg_send()

int cace_amp_proxy_msg_send ( int  sock_fd,
const cace_ari_t dst,
const uint8_t *  data_ptr,
size_t  data_len 
)

Send a message via datagram socket proxy to an ultimate destination.

Parameters
sock_fdThe socket file descriptor. The socket must be ready for writing (e.g. determined via poll() and POLLOUT event) before this call.
[in]dstThe ultimate destination endpoint to send to.
Returns
Zero if successful, non-zero if sending is no longer possible.

References cace_ari_cbor_encode(), cace_data_deinit(), cace_data_init(), CACE_LOG_ERR, CACE_LOG_INFO, CHKERR1, cace_data_t::len, cace_data_t::ptr, and result.

Referenced by sock_worker().