blob: 1a1bd5e8cc32d86b42a9927fbd350076306f83ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#ifndef UDP_BROADCAST_COMMON
#define UDP_BROADCAST_COMMON
#include <arpa/inet.h>
#include <errno.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <net/if.h>
#include <unistd.h>
typedef unsigned char byte;
/* the port users will be connecting to */
#define SERVERPORT 4950
#define SERVERPORT_S "4950"
/* RFC 2460 requires IPv6 link MTU >= 1280, IPv6 UDP headers sum up to
48 byte, the rest is for us. One extra byte is for the final \0
(not transmitted) */
#define MAXBUFLEN 1233
#define ENP(Cmd, Msg) \
if ((Cmd) == -1) { \
perror(Msg); \
exit(1); \
}
#define E0P(Cmd, Msg) \
if ((Cmd) == NULL) { \
perror(Msg); \
exit(1); \
}
#define IGN(Cmd) \
if (Cmd) {}
#endif // UDP_BROADCAST_COMMON
|