]> git.ozlabs.org Git - ppp.git/blob - osf1/ppp_init.c
mods for broken compilers which can't nest ntohl etc.
[ppp.git] / osf1 / ppp_init.c
1 /*
2  *  ppp_init.c --- PPP initialization/configuration for OSF/1.
3  *
4  *  Note:  Checks for #ifdef CFG_OP_CONFIGURE is my cheap way of telling
5  *      whether this system is V3.0+ or V2.0.  Is there a better way?  srt
6  */
7
8 #include <sys/sysconfig.h>
9 #include <sys/stream.h>
10
11 #ifndef PPP_VD
12 #include "ppp.h"
13 #endif
14
15 static int configured = 0;
16 static struct streamadm tmpl_sa = { OSF_STREAMS_11,
17     STR_IS_MODULE|STR_SYSV4_OPEN,
18     NULL,
19     SQLVL_MODULE,
20     NULL };
21
22
23 extern struct streamtab ppp_asyncinfo;
24 extern struct streamtab ppp_ifinfo;
25 extern struct streamtab ppp_compinfo;
26
27 #ifdef CFG_OP_CONFIGURE
28 cfg_subsys_attr_t ppp_attributes[] = {
29     {"", 0, 0, 0, 0, 0, 0}
30 };
31 #endif
32
33 int
34 ppp_configure(op, indata, indata_size, outdata, outdata_size)
35 cfg_op_t  op;
36 char *indata, *outdata;
37 ulong indata_size, outdata_size;
38 {
39     dev_t devno = NODEV;
40     int ret = ESUCCESS;
41     int i;
42
43     switch (op) {
44
45 #ifdef CFG_OP_CONFIGURE
46       case CFG_OP_CONFIGURE:
47 #else
48       case SYSCONFIG_CONFIGURE:
49 #endif
50         if (!configured) {
51             strcpy(tmpl_sa.sa_name, "pppif");
52             if ((devno=strmod_add(NODEV, &ppp_ifinfo, &tmpl_sa)) == NODEV)
53                 return(ENODEV);
54
55             strcpy(tmpl_sa.sa_name, "pppasync");
56             if ((devno=strmod_add(NODEV, &ppp_asyncinfo, &tmpl_sa)) == NODEV) {
57                 strcpy(tmpl_sa.sa_name, "pppif");
58                 strmod_del(NODEV, &ppp_ifinfo, &tmpl_sa);
59                 return(ENODEV);
60             }
61
62             strcpy(tmpl_sa.sa_name, "pppcomp");
63             if ((devno = strmod_add(NODEV, &ppp_compinfo, &tmpl_sa)) == NODEV) {
64                 strcpy(tmpl_sa.sa_name, "pppif");
65                 strmod_del(NODEV, &ppp_ifinfo, &tmpl_sa);
66                 strcpy(tmpl_sa.sa_name, "pppasync");
67                 strmod_del(NODEV, &ppp_asyncinfo, &tmpl_sa);
68                 return(ENODEV);
69             }
70
71             ppp_attach();
72
73             configured = 1;
74         } else
75             ret = EINVAL;
76         break;
77
78       default:
79         ret = EINVAL;
80         break;
81     }
82
83     return(ret);
84 }
85                                    
86
87