1 /*
2  * fiked - a fake IKE PSK+XAUTH daemon based on vpnc
3  * Copyright (C) 2005, Daniel Roethlisberger <daniel@roe.ch>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, see http://www.gnu.org/copyleft/
17  *
18  * $Id: datagram.h 75 2005-11-01 23:29:11Z roe $
19  */
20 
21 #ifndef DATAGRAM_H
22 #define DATAGRAM_H
23 
24 #include <sys/types.h>
25 #include <sys/socket.h>
26 #include <netinet/in.h>
27 
28 #define UDP_DGM_MAXSIZE	65507
29 
30 typedef struct _datagram {
31 	size_t len;
32 	uint8_t *data;
33 	struct sockaddr_in peer_addr;
34 } datagram;
35 
36 typedef struct _udp_socket {
37 	int fd;
38 	uint16_t port;
39 } udp_socket;
40 
41 datagram * datagram_new(size_t size);
42 void datagram_free(datagram *dgm);
43 
44 udp_socket * udp_socket_new(uint16_t port);
45 void udp_socket_free();
46 datagram * udp_socket_recv(udp_socket *s);
47 void udp_socket_send(udp_socket *s, datagram *dgm);
48 
49 #endif /* DATAGRAM_H */
50