Thread: [Netadm-devel] gwc/gwclib Makefile,1.1.1.1,1.2 confproc.c,1.7,1.8 conftab.c,1.2,1.3 confutil.c,1.1.1
Status: Beta
Brought to you by:
linuxpark
From: linuxpark <lin...@us...> - 2006-02-28 23:41:55
|
Update of /cvsroot/netadm/gwc/gwclib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13557/gwclib Modified Files: Makefile confproc.c conftab.c confutil.c sysutil.c Log Message: ADD: ADD: internal routine below in confproc.c, confproc.h add_fc_svc add_fc_net add_fc_fw add_fc_pol : definitly not list_fc_svc list_fc_net list_fc_fw list_fc_pol: not complete yet. del_fc_svc del_fc_net del_fc_fw del_fc_pol: definitly not ADD: internal routine for utils to access shared memory in confutil.c confutil.h conftab.c sys_ucmd_e ucmdtab sys_ucmd_msg ( sys_ucmd_e cmd, void *arg, int len ) : exported library. MOD: rename object name in shared memory (sysshm.h) ADD: Warning message during installation this warning message will be existed until gtk GUI will be completed for gwc-v0.1-pre3. GTK+ daemon will be improved by hyseok hwang <o2...@ho...> gwc-v0.1-pre3 will be released until march. 15. 1006. Index: Makefile =================================================================== RCS file: /cvsroot/netadm/gwc/gwclib/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Makefile 30 Jan 2006 17:41:28 -0000 1.1.1.1 --- Makefile 28 Feb 2006 23:41:50 -0000 1.2 *************** *** 11,15 **** rely=`uname -r | cut -f 2 -d .` ! SYSOBJS = conftab.o \ confutil.o \ confproc.o \ --- 11,15 ---- rely=`uname -r | cut -f 2 -d .` ! SYSOBJS = conftab.o \ confutil.o \ confproc.o \ Index: sysutil.c =================================================================== RCS file: /cvsroot/netadm/gwc/gwclib/sysutil.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** sysutil.c 30 Jan 2006 17:41:28 -0000 1.1.1.1 --- sysutil.c 28 Feb 2006 23:41:50 -0000 1.2 *************** *** 720,721 **** --- 720,722 ---- free(vp); } + Index: confproc.c =================================================================== RCS file: /cvsroot/netadm/gwc/gwclib/confproc.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** confproc.c 28 Feb 2006 00:52:07 -0000 1.7 --- confproc.c 28 Feb 2006 23:41:50 -0000 1.8 *************** *** 47,51 **** #define max(A,B) ((A) > (B) ? (A):(B)) ! extern sys_cmd_t cmdtab[]; extern sm_t *csm; #if 0 --- 47,52 ---- #define max(A,B) ((A) > (B) ? (A):(B)) ! extern sys_cmd_t cmdtab[]; ! extern sys_ucmd_t ucmdtab[]; [...1254 lines suppressed...] --- 2907,2911 ---- *************** *** 2395,2401 **** msg.max_pktrate = csm->hostpol[i].max_pktrate; if ((ret = ioctl(fd, idx, &msg)) < 0) { ! if (errno != EBADSLT) { /* EBADSLT , slot error example no instance in module */ frerr(fr, RET_EIOCTL, ! "%s: Ioctl Failed [name:%s] [IP:%u.%u.%u.%u] [flag:%d] [rate:%d]\n", SZPFDEV, csm->hostpol[i].name, NIPQUAD(csm->hostpol[i].ip), --- 2940,2948 ---- msg.max_pktrate = csm->hostpol[i].max_pktrate; if ((ret = ioctl(fd, idx, &msg)) < 0) { ! if (errno != EBADSLT) { ! /* EBADSLT , slot error example no instance in module */ frerr(fr, RET_EIOCTL, ! "%s: Ioctl Failed [name:%s] [IP:%u.%u.%u.%u] " ! "[flag:%d] [rate:%d]\n", SZPFDEV, csm->hostpol[i].name, NIPQUAD(csm->hostpol[i].ip), Index: confutil.c =================================================================== RCS file: /cvsroot/netadm/gwc/gwclib/confutil.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** confutil.c 30 Jan 2006 17:41:28 -0000 1.1.1.1 --- confutil.c 28 Feb 2006 23:41:50 -0000 1.2 *************** *** 34,37 **** --- 34,38 ---- #include "sysnio.h" #include "sysdef.h" + #include "confutil.h" #if !defined(TRUE) *************** *** 40,44 **** --- 41,107 ---- #endif + extern sm_t *csm; + #define FC_CNT(X) csm->fc_##X ##_cnt + #define FC_OBJ(X, I) csm->fc_##X[I] + #define FC_OBJ_NAME(X, I) csm->fc_##X[I].name + extern sys_cmd_t cmdtab[]; + extern sys_ucmd_t ucmdtab[]; + + void * sys_ucmd_msg (sys_ucmd_e cmd, void *arg, int len) { + /* + * TODO: someday later, lock for shared mem will be needed + * to support multiprocessing by admin + */ + return ucmdtab[cmd].func (arg, len); + } + + void * _get_fc_net ( void *arg, int len) { + int i; + char *name = (char *)arg; + + for ( i = 0 ; i < FC_CNT(net); i++) { + if ( !strncmp (FC_OBJ_NAME(net, i), name, len)) + return &FC_OBJ(net, i); + } + + return NULL; + } + + void * _get_fc_svc ( void *arg, int len) { + int i; + char *name = (char *)arg; + + for ( i = 0 ; i < FC_CNT(svc); i++) { + if ( !strncmp (FC_OBJ_NAME(svc, i), name, len)) + return &FC_OBJ(svc, i); + } + + return NULL; + } + + void * _get_fc_fw ( void *arg, int len) { + int i; + char *name = (char *)arg; + + for ( i = 0 ; i < FC_CNT(fw); i++) { + if ( !strncmp (FC_OBJ_NAME(fw, i), name, len)) + return &FC_OBJ(fw, i); + } + + return NULL; + } + + void * _get_fc_pol ( void *arg, int len) { + int i; + char *name = (char *)arg; + + for ( i = 0 ; i < FC_CNT(pol); i++) { + if ( !strncmp (FC_OBJ_NAME(pol, i), name, len)) + return &FC_OBJ(pol, i); + } + + return NULL; + } char * *************** *** 79,82 **** --- 142,146 ---- map++; } + return frerr(fr, ret, "[%s] must be one of the %s\n", key, msg); } Index: conftab.c =================================================================== RCS file: /cvsroot/netadm/gwc/gwclib/conftab.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** conftab.c 25 Feb 2006 22:59:00 -0000 1.2 --- conftab.c 28 Feb 2006 23:41:50 -0000 1.3 *************** *** 21,26 **** --- 21,28 ---- #include "sysutil.h" #include "sysdef.h" + #include "sysshm.h" #include "confproc.h" #include "message.h" + #include "confutil.h" #ifdef NOPROCNEED #define PR(func) NULL *************** *** 94,95 **** --- 96,105 ---- , }; + + sys_ucmd_t ucmdtab [] = { + { _CMD_GET_FC_NET, _get_fc_net }, + { _CMD_GET_FC_SVC, _get_fc_svc }, + { _CMD_GET_FC_FW, _get_fc_fw }, + { _CMD_GET_FC_POL, _get_fc_pol }, + {0}, + }; |