summaryrefslogtreecommitdiff
path: root/pppd/multilink.h
diff options
context:
space:
mode:
authorEivind Næss <eivnaes@yahoo.com>2023-01-20 22:12:58 -0800
committerGitHub <noreply@github.com>2023-01-21 17:12:58 +1100
commitba7f7e053daae846a54a1d08d3d133a5f1266ace (patch)
tree3da27cf3ca6d6eb76e3f9a05db4c5676591d5002 /pppd/multilink.h
parent76016e1b948b7d9675b4e0750d1f943d96d9523b (diff)
downloadppp-ba7f7e053daae846a54a1d08d3d133a5f1266ace.tar.gz
Header file reorganization and cleaning up the public API for pppd version 2.5.0 (#379)
This commit does several things, being a squash-and-merge of a series of changes; squashed in order not to break bisection. * Clean up pppd.h, moving declarations that should only be accessed by pppd code (not by users of pppd) to a new pppd-private.h. Also, other parts of pppd.h were moved to multilink.h, chap.h, eap.h, eui64.h, and a new options.h. * Provide an API for access to data that is needed by plugins (in no particular order): - ifname - ifunit - remote_name - remote_number - peer_authname - status (now called "code" internally) - phase - doing_multilink - multilink_master - idle_time_limit - link_connect_time - max_connect_time - link_stats - ipparam - hostname - got_sigterm - got_sigusr2 - got_sighup - session_number - maxoctets - maxoctets_dir - debug - persist - devnam - modem - peer_authname - sync_serial * Update the version number to 2.5.0. * Detect availability of stddef.h and stdarg.h. * Rename some headers: - pppcrypt.c/h to crypto_ms.c/h - ppp-crypto.c/h to crypto.c/h - ppp-crypto-priv.h to crypto-priv.h - chap-new.c/h to chap.c/h * Remove chap-md5.h, crypto-priv.h, eap-tls.h, etc. from the list of header files to be installed. * Provide typedefs for the hook functions. * Provide a typedef for the "phase" variable. * Provide a typedef for the link statistics array. * Remove the option_t typedef. * Rename the following functions by adding a "ppp_" prefix (with the intention that these are a "public" API for use by plugins): - option_error - add_options - int_option, - options_from_file - script_setenv - bad_ip_adrs, - netif_get/set_mtu (renamed to ppp_get/set_mtu) - get_time - timeout - untimeout - safe_fork - sys_close - set_session_number - update_link_stats (renamed to ppp_get_link_stats) - add_notifier (renamed to ppp_add_notify) - remove_notifier (renamed to ppp_del_notify) - generic_[dis]establish_ppp (to ppp_generic_[dis]establish) * Rename ppp_devnam to ppp_devname. * Rename ppp_available() to ppp_check_kernel_support(). * Use unsigned char instead of u_char, unsigned short instead of u_short, uint32_t instead of u_int32_t. * Add const to some declarations * Update comments * Change the interface for notifiers to use an enum to identify which notifier is to be modified. * Provide an API for getting the path to a file, with an enum to identify different types of file. * Link plugins with the -DPLUGIN flag [paulus@ozlabs.org - wrote commit message] Signed-off-by: Eivind Næss <eivnaes@yahoo.com> Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Diffstat (limited to 'pppd/multilink.h')
-rw-r--r--pppd/multilink.h112
1 files changed, 112 insertions, 0 deletions
diff --git a/pppd/multilink.h b/pppd/multilink.h
new file mode 100644
index 0000000..e4639bb
--- /dev/null
+++ b/pppd/multilink.h
@@ -0,0 +1,112 @@
+/*
+ * 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"
+
+/*
+ * 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
+#endif // PPP_MULTILINK_H