datagram.h
Go to the documentation of this file.
/*
Copyright (C) 2003-2004 Douglas Thain and the University of Wisconsin
Copyright (C) 2022 The University of Notre Dame
This software is distributed under the GNU General Public License.
See the file COPYING for details.
*/
#ifndef DATAGRAM_H
#define DATAGRAM_H
#define DATAGRAM_ADDRESS_MAX 48
#define DATAGRAM_PAYLOAD_MAX 65536
#define DATAGRAM_PORT_ANY 0
#define DATAGRAM_ADDRESS_BROADCAST "255.255.255.255"
struct datagram *datagram_create(int port);
struct datagram *datagram_create_address(const char *address, int port);
void datagram_delete(struct datagram *d);
int datagram_recv(struct datagram *d, char *data, int length, char *addr, int *port, int timeout);
int datagram_send(struct datagram *d, const char *data, int length, const char *addr, int port);
int datagram_fd(struct datagram *d);
#endif
datagram_delete
void datagram_delete(struct datagram *d)
Destroy a datagram port.
datagram_create_address
struct datagram * datagram_create_address(const char *address, int port)
Create a new address/port for sending or receiving datagrams.
datagram_create
struct datagram * datagram_create(int port)
Create a new port for sending or receiving datagrams.
datagram_recv
int datagram_recv(struct datagram *d, char *data, int length, char *addr, int *port, int timeout)
Receive a datagram.
datagram_send
int datagram_send(struct datagram *d, const char *data, int length, const char *addr, int port)
Send a datagram.
datagram_fd
int datagram_fd(struct datagram *d)
Obtain the file descriptor of a datagram object.