1 /* 2 * spppcomp_mod.c - modload support for PPP compression STREAMS module. 3 * 4 * Copyright (c) 2011 Bayard G. Bell. All rights reserved. 5 * 6 * CONTRIBUTOR MAKES NO REPRESENTATION OR WARRANTIES ABOUT THE SUITABILITY 7 * OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 8 * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 9 * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. CONTRIBUTOR SHALL NOT BE LIABLE 10 * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR 11 * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES 12 * 13 * Copyright (c) 2000 by Sun Microsystems, Inc. 14 * All rights reserved. 15 * 16 * Permission to use, copy, modify, and distribute this software and its 17 * documentation is hereby granted, provided that the above copyright 18 * notice appears in all copies. 19 * 20 * SUN MAKES NO REPRESENTATION OR WARRANTIES ABOUT THE SUITABILITY OF 21 * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 22 * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 23 * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR 24 * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR 25 * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES 26 * 27 * Copyright (c) 1994 The Australian National University. 28 * All rights reserved. 29 * 30 * Permission to use, copy, modify, and distribute this software and its 31 * documentation is hereby granted, provided that the above copyright 32 * notice appears in all copies. This software is provided without any 33 * warranty, express or implied. The Australian National University 34 * makes no representations about the suitability of this software for 35 * any purpose. 36 * 37 * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY 38 * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 39 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF 40 * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY 41 * OF SUCH DAMAGE. 42 * 43 * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, 44 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 45 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 46 * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO 47 * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, 48 * OR MODIFICATIONS. 49 * 50 * This module is derived from the original SVR4 STREAMS PPP compression 51 * module originally written by Paul Mackerras <paul.mackerras@cs.anu.edu.au>. 52 * 53 * James Carlson <james.d.carlson@sun.com> and Adi Masputra 54 * <adi.masputra@sun.com> rewrote and restructured the code for improved 55 * performance and scalability. 56 */ 57 58 #include <sys/types.h> 59 #include <sys/syslog.h> 60 #include <sys/conf.h> 61 #include <sys/errno.h> 62 #include <sys/ddi.h> 63 #include <sys/conf.h> 64 #include <sys/modctl.h> 65 #include <net/pppio.h> 66 67 #include "s_common.h" 68 69 /* 70 * Globals for PPP compression loadable module wrapper 71 */ 72 extern struct streamtab spppcomp_tab; 73 extern const char spppcomp_module_description[]; 74 75 static struct fmodsw fsw = { 76 COMP_MOD_NAME, /* f_name */ 77 &spppcomp_tab, /* f_str */ 78 D_NEW | D_MP | D_MTPERQ /* f_flag */ 79 }; 80 81 static struct modlstrmod modlstrmod = { 82 &mod_strmodops, /* strmod_modops */ 83 (char *)spppcomp_module_description, /* strmod_linkinfo */ 84 &fsw /* strmod_fmodsw */ 85 }; 86 87 static struct modlinkage modlinkage = { 88 MODREV_1, /* ml_rev, has to be MODREV_1 */ 89 (void *) &modlstrmod, /* ml_linkage, NULL-terminated list */ 90 NULL /* of linkage structures */ 91 }; 92 93 int 94 _init(void) 95 { 96 return (mod_install(&modlinkage)); 97 } 98 99 int 100 _fini(void) 101 { 102 return (mod_remove(&modlinkage)); 103 } 104 105 int 106 _info(struct modinfo *modinfop) 107 { 108 return (mod_info(&modlinkage, modinfop)); 109 } 110