Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
#include <netinet/in.h>
#include "std.h"
Go to the source code of this file.
Data Structures | |
struct | UdpSocket |
Functions | |
int | udp_socket_create (struct UdpSocket *sock, char *host, int port_out, int port_in, bool broadcast) |
Create UDP network (in/out sockets). More... | |
int | udp_socket_send (struct UdpSocket *sock, uint8_t *buffer, uint32_t len) |
Send a packet from buffer, blocking. More... | |
int | udp_socket_send_dontwait (struct UdpSocket *sock, uint8_t *buffer, uint32_t len) |
Send a packet from buffer, non-blocking. More... | |
int | udp_socket_recv_dontwait (struct UdpSocket *sock, uint8_t *buffer, uint32_t len) |
Receive a UDP packet, dont wait. More... | |
int | udp_socket_recv (struct UdpSocket *sock, uint8_t *buffer, uint32_t len) |
Receive one UDP packet. More... | |
int | udp_socket_subscribe_multicast (struct UdpSocket *sock, const char *multicast_addr) |
int | udp_socket_set_recvbuf (struct UdpSocket *sock, int buf_size) |
int | udp_socket_set_sendbuf (struct UdpSocket *sock, int buf_size) |
Easily create and use UDP sockets. Basically just some convenience functions around a UDP socket.
Definition in file udp_socket.h.
struct UdpSocket |
Definition at line 34 of file udp_socket.h.
Data Fields | ||
---|---|---|
struct sockaddr_in | addr_in | |
struct sockaddr_in | addr_out | |
int | sockfd |
int udp_socket_create | ( | struct UdpSocket * | sock, |
char * | host, | ||
int | port_out, | ||
int | port_in, | ||
bool | broadcast | ||
) |
Create UDP network (in/out sockets).
[out] | sock | pointer to already allocated UdpSocket struct |
[in] | host | hostname/address |
[in] | port_out | output port |
[in] | port_in | input port (set to < 0 to disable) |
[in] | broadcast | if TRUE enable broadcasting |
Create UDP network (in/out sockets).
[out] | sock | pointer to already allocated UdpSocket struct |
[in] | host | ip address or hostname (hostname not possible if static linking) |
[in] | port_out | output port |
[in] | port_in | input port (set to < 0 to disable) |
[in] | broadcast | if TRUE enable broadcasting |
Definition at line 49 of file udp_socket.c.
References UdpSocket::addr_in, UdpSocket::addr_out, and UdpSocket::sockfd.
Referenced by udp_arch_periph_init(), and viewvideo_init().
Receive one UDP packet.
[in] | sock | pointer to UdpSocket struct |
[out] | buffer | buffer to write received packet to |
[in] | len | buffer length in bytes |
Receive one UDP packet.
[in] | sock | pointer to UdpSocket struct |
[out] | buffer | buffer to write received packet to |
[in] | len | buffer length in bytes (maximum bytes to read) |
Definition at line 185 of file udp_socket.c.
References UdpSocket::addr_in, and UdpSocket::sockfd.
Receive a UDP packet, dont wait.
[in] | sock | pointer to UdpSocket struct |
[out] | buffer | buffer to write received packet to |
[in] | len | buffer length in bytes |
Sets the MSG_DONTWAIT flag, returns 0 if no data is available.
[in] | sock | pointer to UdpSocket struct |
[out] | buffer | buffer to write received packet to |
[in] | len | buffer length in bytes |
Definition at line 160 of file udp_socket.c.
References UdpSocket::addr_in, UdpSocket::sockfd, TRACE, and TRACE_ERROR.
Send a packet from buffer, blocking.
[in] | sock | pointer to UdpSocket struct |
[in] | buffer | buffer to send |
[in] | len | buffer length in bytes |
Definition at line 120 of file udp_socket.c.
References UdpSocket::addr_out, UdpSocket::sockfd, TRACE, and TRACE_ERROR.
Send a packet from buffer, non-blocking.
[in] | sock | pointer to UdpSocket struct |
[in] | buffer | buffer to send |
[in] | len | buffer length in bytes |
Definition at line 141 of file udp_socket.c.
References UdpSocket::addr_out, and UdpSocket::sockfd.
Referenced by rtp_packet_send().
int udp_socket_set_recvbuf | ( | struct UdpSocket * | sock, |
int | buf_size | ||
) |
Definition at line 205 of file udp_socket.c.
References UdpSocket::sockfd.
int udp_socket_set_sendbuf | ( | struct UdpSocket * | sock, |
int | buf_size | ||
) |
Definition at line 220 of file udp_socket.c.
References UdpSocket::sockfd.
int udp_socket_subscribe_multicast | ( | struct UdpSocket * | sock, |
const char * | multicast_addr | ||
) |
Definition at line 194 of file udp_socket.c.
References UdpSocket::sockfd.