forked from xelerance/xl2tpd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
misc.h
82 lines (72 loc) · 1.89 KB
/
misc.h
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
* Layer Two Tunnelling Protocol Daemon
* Copyright (C) 1998 Adtran, Inc.
* Copyright (C) 2002 Jeff McAdams
*
* Mark Spencer
*
* This software is distributed under the terms
* of the GPL, which you should have received
* along with this source.
*
* Misc stuff...
*/
#ifndef _MISC_H
#define _MISC_H
#include <syslog.h>
struct tunnel;
struct buffer
{
int type;
void *rstart;
void *rend;
void *start;
size_t len;
size_t maxlen;
#if 0
unsigned int addr;
int port;
#else
struct sockaddr_in6 peer;
#endif
struct tunnel *tunnel; /* Who owns this packet, if it's a control */
int retries; /* Again, if a control packet, how many retries? */
};
struct ppp_opts
{
char option[MAXSTRLEN];
struct ppp_opts *next;
};
extern char ipaddy_buf[];
extern socklen_t ipaddr_len;
#define IPADDY(a) inet_ntoa(*((struct in_addr *)&(a)))
#define IPADDY6(a) (char *)(inet_ntop(AF_INET6, (struct in6_addr*)&(a), ipaddy_buf, ipaddr_len))
#define DEBUG c ? c->debug || t->debug : t->debug
#ifdef USE_SWAPS_INSTEAD
#define SWAPS(a) ((((a) & 0xFF) << 8 ) | (((a) >> 8) & 0xFF))
#ifdef htons
#undef htons
#endif
#ifdef ntohs
#undef htons
#endif
#define htons(a) SWAPS(a)
#define ntohs(a) SWAPS(a)
#endif
#define halt() printf("Halted.\n") ; for(;;)
extern char hostname[];
extern void l2tp_log (int level, const char *fmt, ...);
extern struct buffer *new_buf (int);
extern void udppush_handler (int);
extern int addfcs (struct buffer *buf);
extern void swaps (void *, int);
extern void do_packet_dump (struct buffer *);
extern void status (const char *fmt, ...);
extern int getPtyMaster(char *, int);
extern void do_control (void);
extern void recycle_buf (struct buffer *);
extern void safe_copy (char *, char *, int);
extern void opt_destroy (struct ppp_opts *);
extern struct ppp_opts *add_opt (struct ppp_opts *, char *, ...);
extern void process_signal (void);
#endif