summaryrefslogtreecommitdiff
path: root/ppp
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2008-05-23 14:32:35 +0000
committerKevin P. Fleming <kpfleming@digium.com>2008-05-23 14:32:35 +0000
commit879dd11beedffead65cb7a3acc4ad99701029584 (patch)
treead44aa991ba5cac155d5a313bcccc2509d7e633b /ppp
parent3403af6f5eba79740c98abb2678f9a66ef5a8190 (diff)
change names and other references in PPP driver module
git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@4336 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'ppp')
-rw-r--r--ppp/Makefile2
-rw-r--r--ppp/dahdi.c (renamed from ppp/zaptel.c)130
2 files changed, 66 insertions, 66 deletions
diff --git a/ppp/Makefile b/ppp/Makefile
index 86b65a6..6b20029 100644
--- a/ppp/Makefile
+++ b/ppp/Makefile
@@ -9,7 +9,7 @@ INCLUDE_DIR = $(includedir)/pppd
LIBDIR = $(libdir)/pppd/$(PPPD_VERSION)
-PLUGINS := zaptel.so
+PLUGINS := dahdi.so
all: $(PLUGINS)
diff --git a/ppp/zaptel.c b/ppp/dahdi.c
index 121bfec..58a5a70 100644
--- a/ppp/zaptel.c
+++ b/ppp/dahdi.c
@@ -1,4 +1,4 @@
-/* zaptel.c - pppd plugin to implement PPP over Zaptel HDLC channel.
+/* dahdi.c - pppd plugin to implement PPP over DAHDI HDLC channel.
*
* Copyright 2002 Digium, Inc.
* Mark Spencer <markster@digium.inc>
@@ -34,106 +34,106 @@
#include <pppd/ccp.h>
#include <pppd/pathnames.h>
-#include "zaptel.h"
+#include <dahdi/user.h>
extern int new_style_driver;
const char pppd_version[] = VERSION;
-#define _PATH_ZAPOPT _ROOT_PATH "/etc/ppp/options."
+#define _PATH_DAHDI_OPT _ROOT_PATH "/etc/ppp/options."
-#define ZAP_MTU (ZT_DEFAULT_MTU_MRU - 16)
+#define DAHDI_MTU (DAHDI_DEFAULT_MTU_MRU - 16)
extern int kill_link;
int retries = 0;
-int setdevname_zaptel(const char *cp);
+int setdevname_dahdi(const char *cp);
-static option_t zaptel_options[] = {
- { "device name", o_wild, (void *) &setdevname_zaptel,
+static option_t dahdi_options[] = {
+ { "device name", o_wild, (void *) &setdevname_dahdi,
"Serial port device name",
OPT_DEVNAM | OPT_PRIVFIX | OPT_NOARG | OPT_A2STRVAL | OPT_STATIC,
devnam},
{ NULL }
};
-static int zapfd = -1;
-static int zapchan = 0;
+static int dahdi_fd = -1;
+static int dahdi_chan = 0;
-static int connect_zaptel(void)
+static int connect_dahdi(void)
{
- ZT_PARAMS ztp;
+ DAHDI_PARAMS dahdi_params;
int res;
int x;
- info("Zaptel device is '%s'\n", devnam);
+ info("DAHDI device is '%s'\n", devnam);
strlcpy(ppp_devnam, devnam, sizeof(ppp_devnam));
if (strlen(devnam) && strcmp(devnam, "stdin")) {
/* Get the channel number */
- zapchan = atoi(devnam);
- if (zapchan < 1) {
+ dahdi_chan = atoi(devnam);
+ if (dahdi_chan < 1) {
fatal("'%s' is not a valid device name\n", devnam);
return -1;
}
- /* Open /dev/zap/channel interface */
- zapfd = open("/dev/zap/channel", O_RDWR);
- if (zapfd < 0) {
- fatal("Unable to open zaptel channel interface: '%s'\n", strerror(errno));
- return zapfd;
+ /* Open /dev/dahdi/channel interface */
+ dahdi_fd = open("/dev/dahdi/channel", O_RDWR);
+ if (dahdi_fd < 0) {
+ fatal("Unable to open DAHDI channel interface: '%s'\n", strerror(errno));
+ return dahdi_fd;
}
/* Specify which channel we really want */
- x = zapchan;
- res = ioctl(zapfd, ZT_SPECIFY, &x);
+ x = dahdi_chan;
+ res = ioctl(dahdi_fd, DAHDI_SPECIFY, &x);
if (res) {
- fatal("Unable to specify channel %d: %s\n", zapchan, strerror(errno));
- close(zapfd);
- zapfd = -1;
+ fatal("Unable to specify channel %d: %s\n", dahdi_chan, strerror(errno));
+ close(dahdi_fd);
+ dahdi_fd = -1;
return -1;
}
} else
- zapfd = STDIN_FILENO;
+ dahdi_fd = STDIN_FILENO;
/* Get channel parameters */
- memset(&ztp, 0, sizeof(ztp));
- ztp.channo = -1;
+ memset(&dahdi_params, 0, sizeof(dahdi_params));
+ dahdi_params.channo = -1;
- res = ioctl(zapfd, ZT_GET_PARAMS, &ztp);
+ res = ioctl(dahdi_fd, DAHDI_GET_PARAMS, &dahdi_params);
if (res) {
- fatal("Device '%s' does not appear to be a zaptel device\n", devnam ? devnam : "<stdin>");
+ fatal("Device '%s' does not appear to be a DAHDI device\n", devnam ? devnam : "<stdin>");
}
x = 1;
/* Throw into HDLC/PPP mode */
- res = ioctl(zapfd, ZT_HDLCPPP, &x);
+ res = ioctl(dahdi_fd, DAHDI_HDLCPPP, &x);
if (res) {
fatal("Unable to put device '%s' into HDLC mode\n", devnam);
- close(zapfd);
- zapfd = -1;
+ close(dahdi_fd);
+ dahdi_fd = -1;
return -1;
}
/* Once the logging is fixed, print a message here indicating
connection parameters */
- zapchan = ztp.channo;
- info("Connected to zaptel device '%s' (%d)\n", ztp.name, ztp.channo);
+ dahdi_chan = dahdi_params.channo;
+ info("Connected to DAHDI device '%s' (%d)\n", dahdi_params.name, dahdi_params.channo);
- return zapfd;
+ return dahdi_fd;
}
-static void disconnect_zaptel(void)
+static void disconnect_dahdi(void)
{
int res;
int x = 0;
/* Throw out of HDLC mode */
- res = ioctl(zapfd, ZT_HDLCPPP, &x);
+ res = ioctl(dahdi_fd, DAHDI_HDLCPPP, &x);
if (res) {
warn("Unable to take device '%s' out of HDLC mode\n", devnam);
@@ -141,22 +141,22 @@ static void disconnect_zaptel(void)
/* Close if it's not stdin */
if (strlen(devnam))
- close(zapfd);
- warn("Disconnect from zaptel");
+ close(dahdi_fd);
+ warn("Disconnect from DAHDI");
}
-static int setspeed_zaptel(const char *cp)
+static int setspeed_dahdi(const char *cp)
{
return 0;
}
-static void zaptel_extra_options()
+static void dahdi_extra_options()
{
int ret;
char buf[256];
- snprintf(buf, 256, _PATH_ZAPOPT "%s",devnam);
+ snprintf(buf, 256, _PATH_DAHDI_OPT "%s",devnam);
if(!options_from_file(buf, 0, 0, 1))
exit(EXIT_OPTION_ERROR);
@@ -164,26 +164,26 @@ static void zaptel_extra_options()
-static void send_config_zaptel(int mtu,
+static void send_config_dahdi(int mtu,
u_int32_t asyncmap,
int pcomp,
int accomp)
{
int sock;
- if (mtu > ZAP_MTU) {
+ if (mtu > DAHDI_MTU) {
warn("Couldn't increase MTU to %d.", mtu);
- mtu = ZAP_MTU;
+ mtu = DAHDI_MTU;
}
}
-static void recv_config_zaptel(int mru,
+static void recv_config_dahdi(int mru,
u_int32_t asyncmap,
int pcomp,
int accomp)
{
- if (mru > ZAP_MTU)
+ if (mru > DAHDI_MTU)
error("Couldn't increase MRU to %d", mru);
}
@@ -194,9 +194,9 @@ static void set_xaccm_pppoe(int unit, ext_accm accm)
-struct channel zaptel_channel;
+struct channel dahdi_channel;
-/* Check is cp is a valid zaptel device
+/* Check is cp is a valid DAHDI device
* return either 1 if "cp" is a reasonable thing to name a device
* or die.
* Note that we don't actually open the device at this point
@@ -205,7 +205,7 @@ struct channel zaptel_channel;
*/
int (*old_setdevname_hook)(const char* cp) = NULL;
-int setdevname_zaptel(const char *cp)
+int setdevname_dahdi(const char *cp)
{
int ret;
int chan;
@@ -218,20 +218,20 @@ int setdevname_zaptel(const char *cp)
if (strcmp(cp, "stdin")) {
ret = sscanf(cp, "%d", &chan);
if (ret != 1) {
- fatal("Zaptel: Invalid channel: '%s'\n", cp);
+ fatal("DAHDI: Invalid channel: '%s'\n", cp);
return -1;
}
}
- zap_copy_string(devnam, cp, sizeof(devnam));
+ dahdi__copy_string(devnam, cp, sizeof(devnam));
- info("Using zaptel device '%s'\n", devnam);
+ info("Using DAHDI device '%s'\n", devnam);
ret = 1;
- if( ret == 1 && the_channel != &zaptel_channel ){
+ if( ret == 1 && the_channel != &dahdi_channel ){
- the_channel = &zaptel_channel;
+ the_channel = &dahdi_channel;
modem = 0;
@@ -262,22 +262,22 @@ int setdevname_zaptel(const char *cp)
void plugin_init(void)
{
if (!ppp_available() && !new_style_driver)
- fatal("Kernel doesn't support ppp_generic needed for Zaptel PPP");
- add_options(zaptel_options);
+ fatal("Kernel doesn't support ppp_generic needed for DAHDI PPP");
+ add_options(dahdi_options);
- info("Zaptel Plugin Initialized");
+ info("DAHDI Plugin Initialized");
}
-struct channel zaptel_channel = {
- options: zaptel_options,
- process_extra_options: &zaptel_extra_options,
+struct channel dahdi_channel = {
+ options: dahdi_options,
+ process_extra_options: &dahdi_extra_options,
check_options: NULL,
- connect: &connect_zaptel,
- disconnect: &disconnect_zaptel,
+ connect: &connect_dahdi,
+ disconnect: &disconnect_dahdi,
establish_ppp: &generic_establish_ppp,
disestablish_ppp: &generic_disestablish_ppp,
- send_config: &send_config_zaptel,
- recv_config: &recv_config_zaptel,
+ send_config: &send_config_dahdi,
+ recv_config: &recv_config_dahdi,
close: NULL,
cleanup: NULL
};