1 | /*
2 | * Layer Two Tunnelling Protocol Daemon
3 | * Copyright (C) 1998 Adtran, Inc.
4 | *
5 | * Mark Spencer
6 | *
7 | * This software is distributed under the terms
8 | * of the GPL, which you should have received
9 | * along with this source.
10 | *
11 | * Misc stuff...
12 | */
13 |
14 | #ifndef _MISC_H
15 | #define _MISC_H
16 |
17 | struct tunnel;
18 | struct buffer
19 | {
20 | int type;
21 | void *rstart;
22 | void *rend;
23 | void *start;
24 | int len;
25 | int maxlen;
26 | #if 0
27 | unsigned int addr;
28 | int port;
29 | #else
30 | struct sockaddr_in peer;
31 | #endif
32 | struct tunnel *tunnel; /* Who owns this packet, if it's a control */
33 | int retries; /* Again, if a control packet, how many retries? */
34 | };
35 |
36 | struct ppp_opts
37 | {
38 | char option[MAXSTRLEN];
39 | struct ppp_opts *next;
40 | };
41 |
42 | #define IPADDY(a) inet_ntoa(*((struct in_addr *)&(a)))
43 |
44 | #define DEBUG c ? c->debug || t->debug : t->debug
45 |
46 | #ifdef USE_SWAPS_INSTEAD
47 | #define SWAPS(a) ((((a) & 0xFF) << 8 ) | (((a) >> 8) & 0xFF))
48 | #ifdef htons
49 | #undef htons
50 | #endif
51 | #ifdef ntohs
52 | #undef htons
53 | #endif
54 | #define htons(a) SWAPS(a)
55 | #define ntohs(a) SWAPS(a)
56 | #endif
57 |
58 | #define LOG_DEBUG 7
59 | #define LOG_LOG 6
60 | #define LOG_WARN 4
61 | #define LOG_CRIT 2
62 |
63 | #define halt() printf("Halted.\n") ; for(;;)
64 |
65 | extern char hostname[];
66 | extern void log (int level, const char *fmt, ...);
67 | extern struct buffer *new_buf (int);
68 | extern void udppush_handler (int);
69 | extern int addfcs (struct buffer *buf);
70 | extern inline void swaps (void *, int);
71 | extern void do_packet_dump (struct buffer *);
72 | extern char *args;
73 | extern void status (const char *fmt, ...);
74 | extern void status_handler (int signal);
75 | extern int getPtyMaster (char *a, char *b);
76 | extern void do_control (void);
77 | extern void recycle_buf (struct buffer *);
78 | extern void safe_copy (char *, char *, int);
79 | extern void opt_destroy (struct ppp_opts *);
80 | extern struct ppp_opts *add_opt (struct ppp_opts *, char *, ...);
81 | #endif