FACT++  1.0
void set_rpc_info ( int *  tag,
char *  buffer,
int *  size 
)

Definition at line 1824 of file dns.c.

References node::conn_id, Debug, dim_print_date_time(), dis_get_conn_id(), dis_selective_update_service, find_services(), Memory::free(), i, Memory::malloc(), MAX_NAME, Net_conns, Rpc_id, Rpc_info, Rpc_info_size, serv::serv_def, serv::serv_id, serv::serv_name, service_exists(), and node::servp.

Referenced by main().

1825 {
1826  char aux[MAX_NAME], rpcaux[MAX_NAME+32], *ptr, *rpcptr;
1827  int i, n, rpc, id[2], conn_id;
1828  DNS_SERVICE *servp, *aux_servp;
1829 
1830  if(size){}
1831  if(tag){}
1832  if(Debug)
1833  {
1835  conn_id = dis_get_conn_id();
1836  printf(" Got Browse Request <%s> from conn: %d %s@%s\n", buffer, conn_id,
1837  Net_conns[conn_id].task,Net_conns[conn_id].node);
1838  }
1839  n = find_services(buffer);
1840  if(Debug)
1841  {
1843  conn_id = dis_get_conn_id();
1844  printf(" Browse Request <%s> found %d services\n", buffer, n);
1845  }
1846  if(!Rpc_info_size)
1847  {
1848  Rpc_info = malloc((size_t)(MAX_NAME*(n+1)*2));
1849  Rpc_info_size = MAX_NAME*(n+1)*2;
1850  }
1851  else if(Rpc_info_size < MAX_NAME*n*2)
1852  {
1853  free(Rpc_info);
1854  Rpc_info = malloc((size_t)(MAX_NAME*(n+1)*2));
1855  Rpc_info_size = MAX_NAME*(n+1)*2;
1856  }
1857  Rpc_info[0] = '\0';
1858  rpcptr = Rpc_info;
1859  for(i = 0; i < n; i++)
1860  {
1861  rpc = 0;
1862  servp = Service_info_list[i];
1863  if(strstr(servp->serv_name,"/Rpc"))
1864  {
1865  strcpy(aux,servp->serv_name);
1866  if( (ptr = strstr(aux,"/RpcIn")) )
1867  {
1868  *ptr = '\0';
1869  rpc = 1;
1870  if( (ptr = strstr(Rpc_info, aux)) )
1871  {
1872  ptr += (int)strlen(aux);
1873  if(*ptr == '|')
1874  rpc = 2;
1875  }
1876  }
1877  if( (ptr = strstr(aux,"/RpcOut")) )
1878  {
1879  *ptr = '\0';
1880  rpc = 1;
1881  if( (ptr = strstr(Rpc_info, aux)) )
1882  {
1883  ptr += (int)strlen(aux);
1884  if(*ptr == '|')
1885  rpc = 2;
1886  }
1887  }
1888  if(rpc == 1)
1889  {
1890  strcpy(rpcaux, aux);
1891  strcat(rpcaux,"|");
1892  strcat(aux,"/RpcIn");
1893  if( (aux_servp = service_exists(aux)) )
1894  {
1895  strcat(rpcaux, aux_servp->serv_def);
1896  strcat(rpcaux,",");
1897  ptr = strstr(aux,"/RpcIn");
1898  *ptr = '\0';
1899  strcat(aux,"/RpcOut");
1900  if( (aux_servp = service_exists(aux)) )
1901  {
1902  strcat(rpcaux,aux_servp->serv_def);
1903  strcat(rpcaux,"|RPC\n");
1904  strcpy(rpcptr, rpcaux);
1905  rpcptr += (int)strlen(rpcaux);
1906  }
1907  }
1908  }
1909  }
1910  else
1911  {
1912  strcpy(rpcaux, servp->serv_name);
1913  strcat(rpcaux,"|");
1914  strcat(rpcaux,servp->serv_def);
1915  if(servp->serv_id & 0x10000000)
1916  strcat(rpcaux,"|CMD\n");
1917  else
1918  strcat(rpcaux,"|\n");
1919  strcpy(rpcptr, rpcaux);
1920  rpcptr += (int)strlen(rpcaux);
1921  }
1922  }
1923  *rpcptr = '\0';
1924  id[0] = dis_get_conn_id();
1925  id[1] = 0;
1928 }
#define MAX_NAME
Definition: dim.h:182
Definition: dns.c:26
#define dis_selective_update_service
Definition: dis.h:24
static int Rpc_id
Definition: dns.c:81
int i
Definition: db_dim_client.c:21
DllExp DIM_NOSHARE NET_CONNECTION * Net_conns
Definition: conn_handler.c:32
char serv_name[MAX_NAME]
Definition: dns.c:49
void * malloc()
Definition: EventBuilder.cc:99
static char * Rpc_info
Definition: dns.c:85
int dis_get_conn_id()
Definition: dis.c:2795
static int Rpc_info_size
Definition: dns.c:86
Definition: dis.c:69
int find_services(char *wild_name)
Definition: dns.c:1718
char serv_def[MAX_NAME]
Definition: dns.c:50
DNS_SERVICE * service_exists(char *name)
Definition: dns.c:1649
int buffer[BUFFSIZE]
Definition: db_dim_client.c:14
int size
Definition: db_dim_server.c:17
void free(void *mem)
void dim_print_date_time()
Definition: utilities.c:134
static int Debug
Definition: dns.c:78
static DNS_SERVICE ** Service_info_list
Definition: dns.c:70
int serv_id
Definition: dns.c:54

+ Here is the call graph for this function:

+ Here is the caller graph for this function: