File: setroute.c

package info (click to toggle)
net-tools 2.10-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,888 kB
  • sloc: ansic: 14,668; makefile: 370; sh: 153
file content (88 lines) | stat: -rw-r--r-- 2,448 bytes parent folder | download | duplicates (6)
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
/*
 * lib/setroute.c     This file contains a small interface function to
 *                      use the AF specific input routine for the routing
 *                      table.
 *
 * 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: setroute.c,v 1.4 2000/05/20 13:38:10 pb Exp $
 *
 * Author:      Bernd 'eckes' Eckenfels <net-tools@lina.inka.de>
 *              Copyright 1999 Bernd Eckenfels, Germany
 *
 * Modifications:
 *
 *960221 {0.01} Bernd Eckenfels:        generated from getroute.c
 *960413 {0.02} Bernd Eckenfels:        new RTACTION support
 *960809        Frank Strauss:          INET6
 *
 *              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 aftype unspec_aftype;
extern struct aftype unix_aftype;
extern struct aftype inet_aftype;
extern struct aftype inet6_aftype;
extern struct aftype ax25_aftype;
extern struct aftype netrom_aftype;
extern struct aftype ipx_aftype;
extern struct aftype ddp_aftype;
extern struct aftype x25_aftype;

void setroute_init(void)
{
#if HAVE_AFINET
    inet_aftype.rinput = INET_rinput;
#endif
#if HAVE_AFINET6
    inet6_aftype.rinput = INET6_rinput;
#endif
#if HAVE_AFNETROM
    netrom_aftype.rinput = NETROM_rinput;
#endif
#if HAVE_AFIPX
    ipx_aftype.rinput = IPX_rinput;
#endif
#if HAVE_AFX25
    x25_aftype.rinput = X25_rinput;
#endif
#if 0
#if HAVE_AFAX25
    ax25_aftype.rinput = AX25_rinput;
#endif
#if HAVE_AFATALK
    ddp_aftype.rinput = DDP_rinput;
#endif
#endif
}


int route_edit(int action, const char *afname, int options, char **argv)
{
    const struct aftype *ap;

    ap = get_aftype(afname);

    if (!ap) {
	fprintf(stderr, _("Address family `%s' not supported.\n"), afname);
	return (E_OPTERR);
    }
    if (!ap->rinput) {
	fprintf(stderr, _("No routing for address family `%s'.\n"), ap->name);
	return (E_OPTERR);
    }
    return (ap->rinput(action, options, argv));
}