Changeset 8455


Ignore:
Timestamp:
03/02/13 22:43:11 (9 years ago)
Author:
gf
Message:

Make ptab in struct s_module embedded not a pointer.

This blows up bss (static) memory nearly twice but we'll get that
back and lots more once we slim down struct s_port in the next
commit.

Location:
trunk
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/globals.h

    r8454 r8455  
    691691#endif
    692692    int32_t         c_port;
    693     PTAB            *ptab;
     693    PTAB            ptab;
    694694    int32_t         num;
    695695};
  • trunk/module-camd33.c

    r8342 r8455  
    166166{
    167167  cfg.c33_crypted = check_filled(cfg.c33_key, sizeof(cfg.c33_key));
    168   static PTAB ptab; //since there is always only 1 camd33 server running, this is threadsafe
    169   ptab.ports[0].s_port = cfg.c33_port;
    170   ph->ptab = &ptab;
    171   ph->ptab->nports = 1;
     168  ph->ptab.nports = 1;
     169  ph->ptab.ports[0].s_port = cfg.c33_port;
    172170
    173171  ph->desc="camd33";
  • trunk/module-camd35.c

    r8411 r8455  
    917917void module_camd35(struct s_module *ph)
    918918{
    919   static PTAB ptab; //since there is always only 1 camd35 server running, this is threadsafe
    920   ptab.ports[0].s_port = cfg.c35_port;
    921   ph->ptab = &ptab;
    922   ph->ptab->nports = 1;
     919  ph->ptab.nports = 1;
     920  ph->ptab.ports[0].s_port = cfg.c35_port;
    923921
    924922  ph->desc="camd35";
     
    949947  ph->large_ecm_support = 1;
    950948  ph->listenertype = LIS_CAMD35TCP;
    951   ph->ptab=&cfg.c35_tcp_ptab;
    952   if (ph->ptab->nports==0)
    953     ph->ptab->nports=1; // show disabled in log
     949  ph->ptab = cfg.c35_tcp_ptab;
    954950  IP_ASSIGN(ph->s_ip, cfg.c35_tcp_srvip);
    955951  ph->s_handler=camd35_server;
  • trunk/module-cccam.c

    r8412 r8455  
    38073807
    38083808#ifdef MODULE_CCCSHARE
    3809     static PTAB ptab; //since there is always only 1 cccam server running, this is threadsafe
    3810     memset(&ptab, 0, sizeof(PTAB));
    38113809    int32_t i;
    38123810    for (i=0;i<CS_MAXPORTS;i++) {
    38133811        if (!cfg.cc_port[i]) break;
    3814         ptab.ports[i].s_port = cfg.cc_port[i];
    3815         ptab.nports++;
    3816     }
    3817 
    3818     ph->ptab = &ptab;
     3812        ph->ptab.ports[i].s_port = cfg.cc_port[i];
     3813        ph->ptab.nports++;
     3814    }
    38193815
    38203816    if (cfg.cc_port[0])
  • trunk/module-csp.c

    r8362 r8455  
    148148void module_csp(struct s_module *ph)
    149149{
    150   static PTAB ptab; //since there is always only 1 csp server running, this is threadsafe
    151   ptab.ports[0].s_port = cfg.csp_port;
    152   ph->ptab = &ptab;
    153   ph->ptab->nports = 1;
     150  ph->ptab.nports = 1;
     151  ph->ptab.ports[0].s_port = cfg.csp_port;
    154152
    155153  ph->desc="csp";
  • trunk/module-ghttp.c

    r8445 r8455  
    259259void module_ghttp(struct s_module *ph)
    260260{
    261   static PTAB ptab;
    262   // ptab.ports[0].s_port = cfg.ghttp_port;
    263   ph->ptab = &ptab;
    264   ph->ptab->nports = 0;
     261  ph->ptab.nports = 0;
     262  // ph->ptab.ports[0].s_port = cfg.ghttp_port;
    265263
    266264  ph->desc = "ghttp";
  • trunk/module-monitor.c

    r8411 r8455  
    867867
    868868void module_monitor(struct s_module *ph){
    869     static PTAB ptab; //since there is always only 1 monitor running, this is threadsafe
    870     ptab.ports[0].s_port = cfg.mon_port;
    871     ph->ptab = &ptab;
    872     ph->ptab->nports = 1;
     869    ph->ptab.nports = 1;
     870    ph->ptab.ports[0].s_port = cfg.mon_port;
    873871    ph->desc = "monitor";
    874872    ph->type=MOD_CONN_UDP;
  • trunk/module-newcamd.c

    r8411 r8455  
    14591459  ph->recv=newcamd_recv;
    14601460  ph->send_dcw=newcamd_send_dcw;
    1461   ph->ptab=&cfg.ncd_ptab;
    1462   if( ph->ptab->nports==0 )
    1463       ph->ptab->nports=1; // show disabled in log
     1461  ph->ptab=cfg.ncd_ptab;
    14641462  ph->c_init=newcamd_client_init;
    14651463  ph->c_recv_chk=newcamd_recv_chk;
  • trunk/module-pandora.c

    r8411 r8455  
    256256
    257257void module_pandora(struct s_module *ph) {
    258     static PTAB ptab;
    259     ptab.ports[0].s_port = cfg.pand_port;
    260     ph->ptab = &ptab;
    261     ph->ptab->nports = 1;
     258    ph->ptab.nports = 1;
     259    ph->ptab.ports[0].s_port = cfg.pand_port;
    262260    ph->num = R_PANDORA;
    263261
  • trunk/module-radegast.c

    r8341 r8455  
    238238void module_radegast(struct s_module *ph)
    239239{
    240   static PTAB ptab; //since there is always only 1 radegast server running, this is threadsafe
    241   ptab.ports[0].s_port = cfg.rad_port;
    242   ph->ptab = &ptab;
    243   ph->ptab->nports = 1;
     240  ph->ptab.nports = 1;
     241  ph->ptab.ports[0].s_port = cfg.rad_port;
    244242
    245243  ph->desc="radegast";
  • trunk/oscam-client.c

    r8411 r8455  
    142142                    (unsigned long)pthread_self(), usr, cs_inet_ntoa(cl->ip), buf, uniq);
    143143                if (client->failban & BAN_DUPLICATE) {
    144                     cs_add_violation_by_ip(ip, get_module(client)->ptab->ports[client->port_idx].s_port, usr);
     144                    cs_add_violation_by_ip(ip, get_module(client)->ptab.ports[client->port_idx].s_port, usr);
    145145                }
    146146                if (cfg.dropdups){
  • trunk/oscam-ecm.c

    r8411 r8455  
    12771277            case 4:
    12781278                // invalid (sfilter)
    1279                 if (!chk_sfilter(er, get_module(client)->ptab))
     1279                if (!chk_sfilter(er, &get_module(client)->ptab))
    12801280                    er->rc = E_INVALID;
    12811281                break;
  • trunk/oscam-failban.c

    r8360 r8455  
    8080void cs_add_violation(struct s_client *cl, char *info) {
    8181    struct s_module *module = get_module(cl);
    82     cs_add_violation_by_ip(cl->ip, module->ptab ? module->ptab->ports[cl->port_idx].s_port : 0, info);
     82    cs_add_violation_by_ip(cl->ip, module->ptab.ports[cl->port_idx].s_port, info);
    8383}
  • trunk/oscam-net.c

    r8402 r8455  
    367367    int32_t scad = sizeof(cad), n;
    368368    struct s_client *cl;
    369     struct s_port *port = &module->ptab->ports[port_idx];
     369    struct s_port *port = &module->ptab.ports[port_idx];
    370370
    371371    if (module->type==MOD_CONN_UDP) {
  • trunk/oscam.c

    r8450 r8455  
    989989        for (k = 0; k < CS_MAX_MOD; k++) {
    990990            struct s_module *module = &modules[k];
    991             if ((module->type & MOD_CONN_NET) && module->ptab) {
    992                 for (j = 0; j < module->ptab->nports; j++) {
    993                     if (module->ptab->ports[j].fd) {
     991            if ((module->type & MOD_CONN_NET)) {
     992                for (j = 0; j < module->ptab.nports; j++) {
     993                    if (module->ptab.ports[j].fd) {
    994994                        cl_size = chk_resize_cllist(&pfd, &cl_list, cl_size, pfdcount);
    995995                        cl_list[pfdcount] = NULL;
    996                         pfd[pfdcount].fd = module->ptab->ports[j].fd;
     996                        pfd[pfdcount].fd = module->ptab.ports[j].fd;
    997997                        pfd[pfdcount++].events = POLLIN | POLLPRI | POLLHUP;
    998998                    }
     
    10661066                for (k = 0; k < CS_MAX_MOD; k++) {
    10671067                    struct s_module *module = &modules[k];
    1068                     if ((module->type & MOD_CONN_NET) && module->ptab) {
    1069                         for (j = 0; j < module->ptab->nports; j++) {
    1070                             if (module->ptab->ports[j].fd && module->ptab->ports[j].fd == pfd[i].fd) {
     1068                    if ((module->type & MOD_CONN_NET)) {
     1069                        for (j = 0; j < module->ptab.nports; j++) {
     1070                            if (module->ptab.ports[j].fd && module->ptab.ports[j].fd == pfd[i].fd) {
    10711071                                accept_connection(module, k, j);
    10721072                            }
     
    14181418    for (i = 0; i < CS_MAX_MOD; i++) {
    14191419        struct s_module *module = &modules[i];
    1420         if ((module->type & MOD_CONN_NET) && module->ptab) {
    1421             for (j = 0; j < module->ptab->nports; j++) {
    1422                 start_listener(module, &module->ptab->ports[j]);
     1420        if ((module->type & MOD_CONN_NET)) {
     1421            for (j = 0; j < module->ptab.nports; j++) {
     1422                start_listener(module, &module->ptab.ports[j]);
    14231423            }
    14241424        }
Note: See TracChangeset for help on using the changeset viewer.