Debian Codegraph @

pppd/multilink.h

raw
1 /*
2 * multilink.h - support routines for multilink.
3 *
4 * Copyright (c) 2000-2024 Paul Mackerras. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
16 * distribution.
17 *
18 * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
19 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
20 * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
21 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
22 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
23 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
24 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
25 */
26
27 #ifndef PPP_MULTILINK_H
28 #define PPP_MULTILINK_H
29
30 #include "pppdconf.h"
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 /*
37 * values for epdisc.class
38 */
39 #define EPD_NULL 0 /* null discriminator, no data */
40 #define EPD_LOCAL 1
41 #define EPD_IP 2
42 #define EPD_MAC 3
43 #define EPD_MAGIC 4
44 #define EPD_PHONENUM 5
45
46 struct epdisc;
47
48 #ifdef PPP_WITH_MULTILINK
49
50 /*
51 * Check multilink-related options
52 */
53 void mp_check_options(void);
54
55 /*
56 * Join our link to an appropriate bundle
57 */
58 int mp_join_bundle(void);
59
60 /*
61 * Disconnected our link from the bundle
62 */
63 void mp_exit_bundle(void);
64
65 /*
66 * Multipoint bundle terminated
67 */
68 void mp_bundle_terminated(void);
69
70 /*
71 * Acting as a multilink master
72 */
73 bool mp_master();
74
75 /*
76 * Was multilink negotiated
77 */
78 bool mp_on();
79
80 /*
81 * Convert an endpoint discriminator to a string
82 */
83 char *epdisc_to_str(struct epdisc *);
84
85 /*
86 * Convert a string to an endpoint discriminator
87 */
88 int str_to_epdisc(struct epdisc *, char *);
89
90 /*
91 * Hook for plugin to hear when an interface joins a multilink bundle
92 */
93 typedef void (multilink_join_hook_fn)(void);
94 extern multilink_join_hook_fn *multilink_join_hook;
95
96 #else
97
98 #define mp_check_options(x) ((void)0)
99 #define mp_join_bundle(x) ((void)0)
100 #define mp_exit_bundle(x) ((void)0)
101 #define mp_bundle_terminated(x) ((void)0)
102
103 static inline bool mp_on() {
104 return false;
105 }
106
107 static inline bool mp_master() {
108 return false;
109 }
110
111 #endif // PPP_WITH_MULTILINK
112
113 #ifdef __cplusplus
114 }
115 #endif
116
117 #endif // PPP_MULTILINK_H