]> git.ozlabs.org Git - ppp.git/blob - osf1/ppp_init.c
71d996e1f710f8ef4a232e968c81afd1d93f991c
[ppp.git] / osf1 / ppp_init.c
1 /*
2  * *****************************************************************
3  * *                                                               *
4  * *    Copyright (c) Digital Equipment Corporation, 1991, 1994    *
5  * *                                                               *
6  * *   All Rights Reserved.  Unpublished rights  reserved  under   *
7  * *   the copyright laws of the United States.                    *
8  * *                                                               *
9  * *   The software contained on this media  is  proprietary  to   *
10  * *   and  embodies  the  confidential  technology  of  Digital   *
11  * *   Equipment Corporation.  Possession, use,  duplication  or   *
12  * *   dissemination of the software and media is authorized only  *
13  * *   pursuant to a valid written license from Digital Equipment  *
14  * *   Corporation.                                                *
15  * *                                                               *
16  * *   RESTRICTED RIGHTS LEGEND   Use, duplication, or disclosure  *
17  * *   by the U.S. Government is subject to restrictions  as  set  *
18  * *   forth in Subparagraph (c)(1)(ii)  of  DFARS  252.227-7013,  *
19  * *   or  in  FAR 52.227-19, as applicable.                       *
20  * *                                                               *
21  * *****************************************************************
22  */
23 /*
24  * HISTORY
25  */
26 /*
27  * static char *rcsid = "@(#)$RCSfile: ppp_init.c,v $ $Revision: 1.1 $ (DEC) $Date: 1995/05/22 02:30:55 $";
28  */
29 /*
30  * (c) Copyright 1990, 1991, 1992 OPEN SOFTWARE FOUNDATION, INC.
31  * ALL RIGHTS RESERVED
32  */
33 /*
34  * OSF/1 Release 1.2
35  */
36
37 /*
38  *      template for the initialization routine for a module/driver
39  *
40  *      - #define STRNAME to driver/module name (with quotes)
41  *        (maximum length FMNAMESZ, which is fixed at 8 + trailing 0).
42  *
43  *      - #define STRCONFIG to the configure entry point's name
44  *
45  *      - #define STRINFO to the driver/module's info structure name.
46  *
47  *      - #define STRFLAGS to STR_IS_DEVICE or STR_IS_MODULE with others
48  *        as appropriate (e.g. STR_SYSV4_OPEN).
49  *
50  *      - #define STRSYNCL, STRSYNCI, STRTTYS to appropriate values if
51  *        not the defaults below. See the manual.
52  *
53  *      - Include this file into module's source file,
54  *        preferably after the streamtab definition
55  *
56  *      - The input buffer, indata, should be of the form "variable=value\n".
57  *        It should always begin with "subsys=subsystem-name\n" and it should
58  *        end with a '\0'. An example would be a subsystem, foo,
59  *        which wants to use a specific device number.  The input buffer,
60  *        indata, should be "subsys=foo\ndevno=123\n\0".
61  *              
62  *      - If your driver should take a specific character device number,
63  *        be sure to pass it within indata (e.g devno=123), else look at 
64  *        outdata for assigned value.
65  *
66  *      - Apart from this change, you'll have to update
67  *
68  *              - kernel/streams/str_config.c
69  *                (insert a call to this routine)
70  *              - kernel/conf/files
71  *                (insert module's source file)
72  */
73
74 #include <sys/sysconfig.h>
75 #include <sys/stream.h>
76
77 #ifndef PPP_VD
78 #include "ppp.h"
79 #endif
80
81 static struct streamadm tmpl_sa;
82
83 extern struct streamtab ppp_asyncinfo;
84 extern struct streamtab ppp_ifinfo;
85 extern struct streamtab ppp_compinfo;
86
87 int
88 ppp_configure(op, indata, indatalen, outdata, outdatalen)
89         sysconfig_op_t  op;
90         char         *  indata;
91         size_t          indatalen;
92         char         *  outdata;
93         size_t          outdatalen;
94 {
95         static dev_t            devno;
96         int                     configured;
97         int                     size;
98         int                     ret = 0;
99         int                     x;
100
101         switch (op) {
102
103         case SYSCONFIG_CONFIGURE:
104
105             tmpl_sa.sa_version           = OSF_STREAMS_11;
106             tmpl_sa.sa_flags             = STR_IS_MODULE|STR_SYSV4_OPEN;
107             tmpl_sa.sa_ttys              = NULL;
108             tmpl_sa.sa_sync_level        = SQLVL_QUEUE;
109             tmpl_sa.sa_sync_info         = 0;
110
111             strcpy(tmpl_sa.sa_name, "pppif");
112
113            if ((devno=    strmod_add(NODEV, &ppp_ifinfo, &tmpl_sa)) == NODEV)
114                 ret = ENODEV;
115             else {
116                 strcpy(tmpl_sa.sa_name, "pppasync");
117                 if ((devno = strmod_add(NODEV, &ppp_asyncinfo, &tmpl_sa)) == NODEV)
118                     ret = ENODEV;
119                 else {
120                     strcpy(tmpl_sa.sa_name, "pppcomp");
121                     if ((devno = strmod_add(NODEV, &ppp_compinfo, &tmpl_sa)) == NODEV)
122                         ret = ENODEV;
123                 }
124             }
125
126             for(x = 0; x < NPPP; x ++)
127                 ppp_attach(x);
128
129             if (outdata && outdatalen>=0)
130                 bcopy(indata,outdata,outdatalen);
131
132             break;
133
134         default:
135             ret = EINVAL;
136             break;
137         }
138
139         return(ret);
140 }