man/pt_BR/ifconfig.8: remove untranslated paragraph
[platform/upstream/net-tools.git] / lib / setroute.c
1 /*
2  * lib/setroute.c     This file contains a small interface function to
3  *                      use the AF specific input routine for the routing
4  *                      table.
5  *
6  * NET-LIB      A collection of functions used from the base set of the
7  *              NET-3 Networking Distribution for the LINUX operating
8  *              system. (net-tools, net-drivers)
9  *
10  * Version:     $Id: setroute.c,v 1.4 2000/05/20 13:38:10 pb Exp $
11  *
12  * Author:      Bernd 'eckes' Eckenfels <net-tools@lina.inka.de>
13  *              Copyright 1999 Bernd Eckenfels, Germany
14  *
15  * Modifications:
16  *
17  *960221 {0.01} Bernd Eckenfels:        generated from getroute.c
18  *960413 {0.02} Bernd Eckenfels:        new RTACTION support
19  *960809        Frank Strauss:          INET6
20  *
21  *              This program is free software; you can redistribute it
22  *              and/or  modify it under  the terms of  the GNU General
23  *              Public  License as  published  by  the  Free  Software
24  *              Foundation;  either  version 2 of the License, or  (at
25  *              your option) any later version.
26  */
27 #include <stdio.h>
28 #include <string.h>
29 #include "net-support.h"
30 #include "pathnames.h"
31 #include "version.h"
32 #include "config.h"
33 #include "intl.h"
34
35 extern struct aftype unspec_aftype;
36 extern struct aftype unix_aftype;
37 extern struct aftype inet_aftype;
38 extern struct aftype inet6_aftype;
39 extern struct aftype ax25_aftype;
40 extern struct aftype netrom_aftype;
41 extern struct aftype ipx_aftype;
42 extern struct aftype ddp_aftype;
43 extern struct aftype x25_aftype;
44
45 void setroute_init(void)
46 {
47 #if HAVE_AFINET
48     inet_aftype.rinput = INET_rinput;
49 #endif
50 #if HAVE_AFINET6
51     inet6_aftype.rinput = INET6_rinput;
52 #endif
53 #if HAVE_AFNETROM
54     netrom_aftype.rinput = NETROM_rinput;
55 #endif
56 #if HAVE_AFIPX
57     ipx_aftype.rinput = IPX_rinput;
58 #endif
59 #if HAVE_AFX25
60     x25_aftype.rinput = X25_rinput;
61 #endif
62 #if 0
63 #if HAVE_AFAX25
64     ax25_aftype.rinput = AX25_rinput;
65 #endif
66 #if HAVE_AFATALK
67     ddp_aftype.rinput = DDP_rinput;
68 #endif
69 #endif
70 }
71
72
73 int route_edit(int action, const char *afname, int options, char **argv)
74 {
75     struct aftype *ap;
76
77     ap = get_aftype(afname);
78
79     if (!ap) {
80         fprintf(stderr, _("Address family `%s' not supported.\n"), afname);
81         return (E_OPTERR);
82     }
83     if (!ap->rinput) {
84         fprintf(stderr, _("No routing for address family `%s'.\n"), ap->name);
85         return (E_OPTERR);
86     }
87     return (ap->rinput(action, options, argv));
88 }