/***************************************************************************** @(#) $Id: sysctl_net_ss7.c,v 0.7 2000/09/07 11:12:13 brian Exp $ ----------------------------------------------------------------------------- Copyright (C) 1997, 1998, 1999, 2000 Brian Bidulock All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Last Modified $Date: 2000/09/07 11:12:13 $ by $Author: brian $ ----------------------------------------------------------------------------- $Log: sysctl_net_ss7.c,v $ Revision 0.7 2000/09/07 11:12:13 brian Initial import of OpenSS7. Revision 1.1.1.1 2000/09/05 11:00:20 brian Initial import of new OpenSS7 stack for Linux. *****************************************************************************/ /* * sysctl interface to the SS7 subsystem * * things to be set on a system-wide protocol basis */ #include #include #include #include #include #include #include static int min_timer[] = {1 * HZ}; static int max_timer[] = {300 * HZ}; static struct ctl_table_header *ss7_table_header; static ctl_table *ss7_table = NULL; static int ss7_table_size = 0; static ctl_table ss7_dir_table[] = { /* FIXME: NET_SS7 must be added to */ {NET_SS7, "ss7", NULL, 0, 0555, ss7_table}, {0} }; static ctl_table ss7_root_table[] = { {CTL_NET, "net", NULL, 0, 0555, ss7_dir_table}, {0} }; static ctl_table ss7_table[] = { {NET_SS7_TRANSFER_FUNCTION, "trasnfer_function", &sysctl_ss7_transfer_function, sizeof(int), 0644, NULL, &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_timer, &max_timer}, {NET_SS7_DUMMY_SYSCTL_0, "dummy_sysctl_0", &sysctl_ss7_dummy_sysctl_0, sizeof(int), 0644, NULL, &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_timer, &max_timer}, {NET_SS7_DUMMY_SYSCTL_1, "dummy_sysctl_1", &sysctl_ss7_dummy_sysctl_1, sizeof(int), 0644, NULL, &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_timer, &max_timer}, {NET_SS7_DUMMY_SYSCTL_2, "dummy_sysctl_2", &sysctl_ss7_dummy_sysctl_2, sizeof(int), 0644, NULL, &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_timer, &max_timer}, {NET_SS7_DUMMY_SYSCTL_3, "dummy_sysctl_3", &sysctl_ss7_dummy_sysctl_3, sizeof(int), 0644, NULL, &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_timer, &max_timer}, {0} }; /* * I have subtables: one for each SS7 link. Iterate through all of the * device subtables setting their device sysctls and proc entries. * */ void ss7_register_sysctl(void) { ss7_iface *ss7_iface; int n, k; for ( ss7_table_size = sizeof(ctl_table), ss7_iface = ss7_iface_list; ss7_iface != NULL; ss7_iface = ss7_iface->next); if ((ss7_table = kmalloc(ss7_table_size, GFP_ATOMIC)) == NULL) return; memset(ss7_table, 0x00, ss7_table_size); for ( n = 0, ss7_iface = ss7_iface_list; ss7_iface != NULL; ss7_iface = ss7_iface->next) { ss7_table[n].ctl_name = n + 1; ss7_table[n].procname = ss7_iface->dev->name; ss7_table[n].data = NULL; ss7_table[n].maxlen = 0; ss7_table[n].mode = 0555; ss7_table[n].child = ss7_iface->systable; ss7_table[n].proc_handler = NULL; memcpy(ss7_iface->systable, ss7_param_table, sizeof(ss7_iface->systable)); ss7_iface->systable[SS7_MAX_VALUES].ctl_name = 0; for (k = 0; k < SS7_MAX_VALUES; k++) ss7_iface->systable[k].data = &ss7_iface->values[k]; n++; } ss7_dir_table[0].child = ss7_table; ss7_table_header = register_sysctl_table(ss7_root_table, 1); } void ss7_unregister_sysctl(void) { unregister_sysctl_table(ss7_table_header); kfree(ss7_table); ss7_dir_table[0].child = NULL; } __initfunc(void ss7_register_sysctl(void)) { ss7_table_header = register_sysctl_table(ss7_root_table, 1); } void ss7_unregister_sysctl(void) { unregister_sysctl_table(ss7_table_header); }