]> git.ozlabs.org Git - ppp.git/blob - osf1/ppp_init.c
new portable STREAMS modules
[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 #else
32 typedef sysconfig_op_t cfg_op_t;
33 #endif
34
35 int
36 ppp_configure(op, indata, indata_size, outdata, outdata_size)
37 cfg_op_t  op;
38 char *indata, *outdata;
39 ulong indata_size, outdata_size;
40 {
41     dev_t devno = NODEV;
42     int ret = ESUCCESS;
43     int i;
44
45     switch (op) {
46
47 #ifdef CFG_OP_CONFIGURE
48       case CFG_OP_CONFIGURE:
49 #else
50       case SYSCONFIG_CONFIGURE:
51 #endif
52         if (!configured) {
53             strcpy(tmpl_sa.sa_name, "pppif");
54             if ((devno=strmod_add(NODEV, &ppp_ifinfo, &tmpl_sa)) == NODEV)
55                 return(ENODEV);
56
57             strcpy(tmpl_sa.sa_name, "pppasync");
58             if ((devno=strmod_add(NODEV, &ppp_asyncinfo, &tmpl_sa)) == NODEV) {
59                 strcpy(tmpl_sa.sa_name, "pppif");
60                 strmod_del(NODEV, &ppp_ifinfo, &tmpl_sa);
61                 return(ENODEV);
62             }
63
64             strcpy(tmpl_sa.sa_name, "pppcomp");
65             if ((devno = strmod_add(NODEV, &ppp_compinfo, &tmpl_sa)) == NODEV) {
66                 strcpy(tmpl_sa.sa_name, "pppif");
67                 strmod_del(NODEV, &ppp_ifinfo, &tmpl_sa);
68                 strcpy(tmpl_sa.sa_name, "pppasync");
69                 strmod_del(NODEV, &ppp_asyncinfo, &tmpl_sa);
70                 return(ENODEV);
71             }
72
73             ppp_attach();
74
75             configured = 1;
76         } else
77             ret = EINVAL;
78         break;
79
80       default:
81         ret = EINVAL;
82         break;
83     }
84
85     return(ret);
86 }
87                                    
88
89