File: activate.c

package info (click to toggle)
net-tools 1.60-17
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,432 kB
  • ctags: 1,149
  • sloc: ansic: 13,450; makefile: 305; sh: 102
file content (77 lines) | stat: -rw-r--r-- 2,329 bytes parent folder | download | duplicates (9)
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
/*
 * lib/activate.c     This file contains a small interface function to
 *                      use the HW specific activate routines for line
 *                      disciplines
 *
 * NET-LIB      A collection of functions used from the base set of the
 *              NET-3 Networking Distribution for the LINUX operating
 *              system. (net-tools, net-drivers)
 *
 * Version:     $Id: activate.c,v 1.3 1998/11/15 20:08:55 freitag Exp $
 *
 * Author:      Bernd 'eckes' Eckenfels <net-tools@lina.inka.de>
 *              Copyright 1996 Bernd Eckenfels, Germany
 *
 * Modifications:
 *
 *960322 {0.01} Bernd Eckenfels:        creation
 *980411 {0.01i} Arnaldo Carvalho:      i18n: now uses gettext
 *
 *              This program is free software; you can redistribute it
 *              and/or  modify it under  the terms of  the GNU General
 *              Public  License as  published  by  the  Free  Software
 *              Foundation;  either  version 2 of the License, or  (at
 *              your option) any later version.
 */
#include <stdio.h>
#include <string.h>
#include "net-support.h"
#include "pathnames.h"
#include "version.h"
#include "config.h"
#include "intl.h"

extern struct hwtype slip_hwtype;
extern struct hwtype cslip_hwtype;
extern struct hwtype slip6_hwtype;
extern struct hwtype cslip6_hwtype;
extern struct hwtype adaptive_hwtype;
extern struct hwtype ppp_hwtype;

extern int SLIP_activate(int fd);
extern int CSLIP_activate(int fd);
extern int SLIP6_activate(int fd);
extern int CSLIP6_activate(int fd);
extern int ADAPTIVE_activate(int fd);
extern int PPP_activate(int fd);

void activate_init(void)
{
#if HAVE_HWSLIP
    slip_hwtype.activate = SLIP_activate;
    cslip_hwtype.activate = CSLIP_activate;
    slip6_hwtype.activate = SLIP6_activate;
    cslip6_hwtype.activate = CSLIP6_activate;
    adaptive_hwtype.activate = ADAPTIVE_activate;
#endif
#if HAVE_HWPPP
    ppp_hwtype.activate = PPP_activate;
#endif
}

int activate_ld(const char *hwname, int fd)
{
    struct hwtype *hw;

    hw = get_hwtype(hwname);

    if (!hw) {
	fprintf(stderr, _("Hardware type `%s' not supported.\n"), hwname);
	return (E_NOSUPP);
    }
    if (!hw->activate) {
	fprintf(stderr, _("Cannot change line discipline to `%s'.\n"), hw->name);
	return (E_OPTERR);
    }
    return (hw->activate(fd));
}