summaryrefslogtreecommitdiff
path: root/pppd/multilink.h
blob: acf448a09713763f73e248c8ac0a7d47c6a4e9d2 (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
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*
 * multilink.h - support routines for multilink.
 *
 * Copyright (c) 2000-2002 Paul Mackerras. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. The name(s) of the authors of this software must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission.
 *
 * 3. Redistributions of any form whatsoever must retain the following
 *    acknowledgment:
 *    "This product includes software developed by Paul Mackerras
 *     <paulus@samba.org>".
 *
 * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#ifndef PPP_MULTILINK_H
#define PPP_MULTILINK_H

#include "pppdconf.h"

#ifdef __cplusplus
extern "C" {
#endif

/*
 * values for epdisc.class
 */
#define EPD_NULL        0	/* null discriminator, no data */
#define EPD_LOCAL       1
#define EPD_IP          2
#define EPD_MAC         3
#define EPD_MAGIC       4
#define EPD_PHONENUM    5

struct epdisc;

#ifdef PPP_WITH_MULTILINK

/*
 * Check multilink-related options
 */
void mp_check_options(void);

/*
 * Join our link to an appropriate bundle
 */
int mp_join_bundle(void);

/*
 * Disconnected our link from the bundle
 */
void mp_exit_bundle(void);

/*
 * Multipoint bundle terminated
 */
void mp_bundle_terminated(void);

/*
 * Acting as a multilink master
 */
bool mp_master();

/*
 * Was multilink negotiated
 */
bool mp_on();

/*
 * Convert an endpoint discriminator to a string
 */
char *epdisc_to_str(struct epdisc *);

/*
 * Convert a string to an endpoint discriminator
 */
int str_to_epdisc(struct epdisc *, char *);

/*
 * Hook for plugin to hear when an interface joins a multilink bundle
 */
typedef void (multilink_join_hook_fn)(void);
extern multilink_join_hook_fn *multilink_join_hook;

#else

#define mp_check_options(x)     ((void)0)
#define mp_join_bundle(x)       ((void)0)
#define mp_exit_bundle(x)       ((void)0)
#define mp_bundle_terminated(x) ((void)0)

static inline bool mp_on() {
    return false;
}

static inline bool mp_master() {
    return false;
}

#endif // PPP_WITH_MULTILINK

#ifdef __cplusplus
}
#endif

#endif // PPP_MULTILINK_H