FACT++  1.0
int findSmiServices ( BROWSER browserp,
SERVER servp 
)

Definition at line 2061 of file webDid.c.

References objstate::browserp, checkSmiObjName(), bitem::curr_smidomain, bitem::curr_smidomain_nobjs, bitem::curr_smidomain_size, dic_info_service(), dic_release_service(), findSmiModeObj(), Memory::free(), i, Memory::malloc(), objstate::mode_index, MONITORED, bitem::n_services, DNS_SERVER_INFO::n_services, item::name, objstate::name, DNS_SERVICE_INFO::name, no_link_str, item::server, item::service_ptr, bitem::servicep, objstate::sid, bitem::smidomainp, objstate::state, DNS_SERVICE_INFO::status, and update_smi_state().

Referenced by prepareJSONSmiObjectList().

2062 {
2063  DNS_SERVICE_INFO *servicep;
2064  int n_services, i, index;
2065  int n_found = 0, sid;
2066  int checkSmiObjName();
2067  int findSmiModeObj();
2068 
2069  n_services = servp->server.n_services;
2070  if(strcmp(browserp->curr_smidomain,servp->name))
2071  {
2072  if(browserp->curr_smidomain[0] != '\0')
2073  {
2074 // unsubscribe; free
2075  for(i = 0; i < browserp->curr_smidomain_size; i++)
2076  {
2077  if(browserp->smidomainp[i].sid)
2078  dic_release_service(browserp->smidomainp[i].sid);
2079  }
2080  free(browserp->smidomainp);
2081  browserp->curr_smidomain[0] = '\0';
2082  browserp->curr_smidomain_size = 0;
2083  }
2084  strcpy(browserp->curr_smidomain, servp->name);
2085  browserp->smidomainp = malloc(n_services * sizeof(OBJSTATE));
2086  browserp->curr_smidomain_size = n_services;
2087  }
2088  else
2089  return browserp->curr_smidomain_nobjs;
2090  servicep = servp->service_ptr;
2091  for(i = 0; i < n_services; i++)
2092  {
2093  browserp->smidomainp[i].sid = 0;
2094  browserp->smidomainp[i].state[0] = '\0';
2095  if(checkSmiObjName(servicep))
2096  {
2097  strcpy(browserp->smidomainp[i].name, servicep->name);
2098 // strcpy(browserp->smidomainp[i].state, "");
2099  browserp->smidomainp[i].browserp = browserp;
2100 //printf("address %s %08x\n",browserp->smidomainp[i].name, (unsigned int)&(browserp->smidomainp[i]));
2101  sid = dic_info_service(servicep->name,MONITORED,0,0,0,update_smi_state, &(browserp->smidomainp[i]),
2102  no_link_str, 5);
2103  browserp->smidomainp[i].sid = sid;
2104  if(servicep->status == 2)
2105  n_found++;
2106  }
2107  servicep++;
2108  }
2109  servicep = servp->service_ptr;
2110  for(i = 0; i < n_services; i++)
2111  {
2112  if(servicep->status == 2)
2113  {
2114  index = findSmiModeObj(servp->service_ptr, n_services, servicep->name);
2115  browserp->smidomainp[i].mode_index = index;
2116  }
2117  servicep++;
2118  }
2119  browserp->curr_smidomain_nobjs = n_found;
2120  return n_found;
2121 }
unsigned dic_info_service(char *serv_name, int req_type, int req_timeout, void *serv_address, int serv_size, void(*usr_routine)(), dim_long tag, void *fill_addr, int fill_size)
Definition: dic.c:601
int findSmiModeObj(DNS_SERVICE_INFO *serviceptr, int n_services, char *name)
Definition: webDid.c:2123
int i
Definition: db_dim_client.c:21
#define MONITORED
Definition: dim_common.h:9
void * malloc()
Definition: EventBuilder.cc:99
int sid
Definition: webDid.c:51
char name[132]
Definition: did.h:46
char name[MAX_NAME]
Definition: webDid.c:49
int mode_index
Definition: webDid.c:52
void update_smi_state(OBJSTATE **tag, char *data, int *size)
Definition: webDid.c:2044
static char no_link_str[5]
Definition: webDid.c:108
DNS_SERVICE_INFO * service_ptr
Definition: did.h:45
char name[MAX_NAME]
Definition: dim.h:331
int curr_smidomain_nobjs
Definition: webDid.c:85
DNS_SERVER_INFO server
Definition: did.h:44
int status
Definition: dim.h:333
int checkSmiObjName(DNS_SERVICE_INFO *servicep)
Definition: webDid.c:2161
void free(void *mem)
char state[512]
Definition: webDid.c:50
void * browserp
Definition: webDid.c:53
int curr_smidomain_size
Definition: webDid.c:84
int n_services
Definition: dim.h:341
void dic_release_service(unsigned service_id)
Definition: dic.c:1025
OBJSTATE * smidomainp
Definition: webDid.c:86
char curr_smidomain[MAX_NAME]
Definition: webDid.c:83

+ Here is the call graph for this function:

+ Here is the caller graph for this function: