cctools
datagram.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2003-2004 Douglas Thain and the University of Wisconsin
3 Copyright (C) 2005- The University of Notre Dame
4 This software is distributed under the GNU General Public License.
5 See the file COPYING for details.
6 */
7 
8 #ifndef DATAGRAM_H
9 #define DATAGRAM_H
10 
61 #define DATAGRAM_ADDRESS_MAX 48
62 
64 #define DATAGRAM_PAYLOAD_MAX 65536
65 
67 #define DATAGRAM_PORT_ANY 0
68 
70 #define DATAGRAM_ADDRESS_BROADCAST "255.255.255.255"
71 
76 struct datagram *datagram_create(int port);
77 
83 struct datagram *datagram_create_address(const char *address, int port);
84 
88 void datagram_delete(struct datagram *d);
89 
99 int datagram_recv(struct datagram *d, char *data, int length, char *addr, int *port, int timeout);
100 
109 int datagram_send(struct datagram *d, const char *data, int length, const char *addr, int port);
110 
115 int datagram_fd(struct datagram *d);
116 
117 #endif
int datagram_send(struct datagram *d, const char *data, int length, const char *addr, int port)
Send a datagram.
struct datagram * datagram_create(int port)
Create a new port for sending or receiving datagrams.
int datagram_recv(struct datagram *d, char *data, int length, char *addr, int *port, int timeout)
Receive a datagram.
void datagram_delete(struct datagram *d)
Destroy a datagram port.
struct datagram * datagram_create_address(const char *address, int port)
Create a new address/port for sending or receiving datagrams.
int datagram_fd(struct datagram *d)
Obtain the file descriptor of a datagram object.