125 char icon_title[128];
136 strcpy(dns_node, local_node);
148 sprintf(icon_title,
"DID %s",dns_node);
150 printf(
"webDid Starting up on %s\n\t serving %s\n", local_node,
Title);
162 servp = nodep->server_head;
181 if(!strcmp(nodep->name,node))
199 if(strstr(servicep->
name, pattern))
211 int ret, n_found = 0;
212 int n_servers_found = 0;
216 servp = nodep->server_head;
234 *n_servers = n_servers_found;
245 if(!strcmp(servicep->
name,service))
260 if(browserp->
id ==
id)
292 if(browserp->
pattern[0] !=
'\0')
327 if(*(
char *)buffer == -1)
353 if( (ptr = strstr(str,
"/CLIENT_LIST")) )
379 strcpy(servp->
name,sname);
385 if(strstr(sname,
"_SMI"))
462 sprintf(str,
"%s/SERVICE_LIST",server);
503 sprintf(str,
"%s/SERVICE_LIST",server);
571 char str[256], *ptr, *ptr1;
574 strcpy(str, service);
577 if( (ptr = strstr(str,
"/RpcIn")) )
582 if( (ptr = strstr(str,
"/RpcOut")) )
588 if( (ptr = strstr(buffer, str)) )
592 ptr += (int)strlen(str);
593 ptr1 = strchr(ptr,
'|');
595 else if(rpc_flag == 1)
597 ptr += (int)strlen(str);
598 ptr1 = strchr(ptr,
',');
602 ptr += (int)strlen(str);
603 ptr = strchr(ptr,
',');
605 ptr1 = strchr(ptr,
'|');
607 strncpy(format,ptr,(
size_t)(ptr1 - ptr));
608 format[(int)(ptr1-ptr)] =
'\0';
616 printf(
"\nUnsubscribing %s\n\n",servicep->
name);
651 printf(
"\nCheck_browser %d\n",browserp->
id);
652 tsecs =
time((time_t *)0);
656 printf(
"\nDeleting browser %d\n\n",browserp->
id);
706 printf(
"CMD data %s %s\n",service,format);
713 sprintf(answer,
"To %s (%s)",service, format);
727 if(!Curr_service_head)
748 strcpy(servicep->
name,service);
757 tsecs =
time((time_t *)0);
797 int service_changed = 0;
803 if(!Curr_service_head)
808 if(service[0] !=
'\0')
833 sprintf(answer,
"%d %d %d %d %d %d %d\n",
837 tsecs =
time((time_t *)0);
866 strcpy(browserp->
pattern, pattern);
887 memcpy(servicep->
buffer, (
char *)buffer, (
size_t)*size);
899 if((*size == 4 ) && (*buffer == -1))
911 tsecs =
time((time_t *)0);
923 char timestr[256], aux[64], sizestr[64];
924 int quality = 0, secs = 0, mili = 0;
929 sprintf(sizestr,
"%d bytes",size);
930 else if (size < 1024*1024)
931 sprintf(sizestr,
"%2.2f Kb",(
float)size/1024);
933 sprintf(sizestr,
"%2.2f Mb",(
float)size/(1024*1024));
936 "<FONT FACE=\"consolas\">Service %s (%s) Contents :<br /> <br />",
Curr_service_name,
943 ptr = strrchr(timestr,
' ');
946 strcat(timestr, aux);
947 timestr[(int)strlen(timestr)-1] =
'\0';
949 sprintf(str,
" Timestamp: %s         Quality: %d    Size: %s<br /><br />",
950 timestr, quality, sizestr);
961 sscanf(ptr,
"%d", &num);
964 if( (ptr = strchr(ptr,
';')) )
998 size = ssize/(int)
sizeof(
int);
1001 psize = size * (int)
sizeof(
int);
1008 size = ssize/(int)
sizeof(
int);
1011 psize = size * (int)
sizeof(
int);
1018 size = ssize/(int)
sizeof(
short);
1021 psize = size * (int)
sizeof(
short);
1028 size = ssize/(int)
sizeof(
float);
1031 psize = size * (int)
sizeof(
float);
1038 size = ssize/(int)
sizeof(
double);
1041 psize = size * (int)
sizeof(
double);
1048 size = ssize/(int)
sizeof(
longlong);
1051 psize = size * (int)
sizeof(
longlong);
1065 ptr = (
char *)ptr + psize;
1076 min =
sprintf(tmp,
"%d",value);
1077 for(i = 0; i < (n-min); i++)
1079 strcat(str,
" ");
1087 char *ptr,
str[80], tmp[256];
1092 for( i = 0; i <
size; i++)
1099 strcat(tmp,
" ");
1106 sprintf(str,
"    %08X",buff[i]);
1108 last[i%4] = buff[
i];
1109 if((i%4 == 3) || (i == (size-1)))
1111 strcat(tmp,
"<br />");
1112 for(j = 0; j <= (i%4); j++)
1115 strcat(tmp,
"        D: ");
1119 strcat(tmp,
"<br />");
1122 ptr += (int)strlen(tmp);
1124 strcpy(tmp,
"<br />");
1131 char *ptr,
str[80], tmp[256];
1136 for( i = 0; i <
size; i++)
1143 strcat(tmp,
" ");
1150 sprintf(str,
"    %08X",(
unsigned)buff[i]);
1152 last[i%4] = buff[
i];
1153 if((i%4 == 3) || (i == (size-1)))
1155 strcat(tmp,
"<br />");
1156 for(j = 0; j <= (i%4); j++)
1159 strcat(tmp,
"        D: ");
1163 strcat(tmp,
"<br />");
1166 ptr += (int)strlen(tmp);
1168 strcpy(tmp,
"<br />");
1175 char *ptr,
str[80], tmp[256];
1180 for( i = 0; i <
size; i++)
1187 strcat(tmp,
" ");
1194 sprintf(str,
"  %04X",buff[i]);
1196 last[i%8] = buff[
i];
1197 if((i%8 == 7) || (i == (size-1)))
1199 strcat(tmp,
"<br />");
1200 for(j = 0; j <= (i%8); j++)
1203 strcat(tmp,
"        D: ");
1207 strcat(tmp,
"<br />");
1210 ptr += (int)strlen(tmp);
1212 strcpy(tmp,
"<br />");
1219 char *asc, *ptr,
str[80], tmp[256];
1224 for( i = 0; i <
size; i++)
1231 strcat(tmp,
" ");
1242 strcat(tmp,&str[(
int)strlen(str)-2]);
1247 if((i%16 == 15) || (i == (size-1)))
1251 for(j = 1; j < 16 - (i%16); j++)
1252 strcat(tmp,
"   ");
1254 strcat(tmp,
"    '");
1255 for(j = 0; j <= (i%16) ; j++)
1261 else if(asc[j] ==
'<')
1263 else if(asc[j] ==
'>')
1265 else if(asc[j] ==
'&')
1277 strcat(tmp,
"'<br />");
1278 asc = (
char *)&buff[i+1];
1281 ptr += (int)strlen(tmp);
1283 strcpy(tmp,
"<br />");
1290 char *ptr,
str[80], tmp[256];
1294 for( i = 0; i <
size; i++)
1301 strcat(tmp,
" ");
1306 sprintf(str,
"%12.3G",*(buff++));
1308 if((i%4 == 3) || (i == size-1))
1310 strcat(tmp,
"<br />");
1313 ptr += (int)strlen(tmp);
1315 strcpy(tmp,
"<br />");
1317 ptr += (int)strlen(tmp);
1323 char *ptr,
str[80], tmp[256];
1327 for( i = 0; i <
size; i++)
1334 strcat(tmp,
" ");
1339 sprintf(str,
"%12.3G",*(buff++));
1341 if((i%4 == 3) || (i == size-1))
1343 strcat(tmp,
"<br />");
1346 ptr += (int)strlen(tmp);
1348 strcpy(tmp,
"<br />");
1350 ptr += (int)strlen(tmp);
1358 ptro = ptr + (int)strlen(ptr);
1367 ptro = ptr + (int)strlen(ptr);
1376 ptro = ptr + (int)strlen(ptr);
1385 ptro = ptr + (int)strlen(ptr);
1397 ptro = ptr + (int)strlen(ptr);
1406 strcat(ptr,
" },\n");
1409 ptro = ptr + (int)strlen(ptr);
1422 if(browserp->
pattern[0] !=
'\0')
1444 browserp->
isSMI = 1;
1445 strcpy(browserp->
pattern,
"SMI/");
1451 if(browserp->
pattern[0] !=
'\0')
1481 for(i = 0; i < ((int)strlen(label) + 1); i++)
1483 label[
i] = (char)tolower((
int)label[
i]);
1498 char str[256], aux[128];
1502 int ret, n_found = 0;
1506 if(browserp->
pattern[0] !=
'\0')
1538 if(!strcmp(node,
"src"))
1542 sprintf(str,
"text: \"%s\", id: \"Nodes\", expanded: false",
Title);
1571 sprintf(str,
"text: \"%s\", id: \"%s\", qtip: \"%s\"",
1572 aux, nodep->name, nodep->name);
1576 printf(
"adding %s %d %d\n",nodep->name, n_nodes, tot_n_nodes);
1577 if(n_nodes < tot_n_nodes)
1590 browserp->
n_nodes = tot_n_nodes;
1599 servp = nodep->server_head;
1604 if(servp->
busy != 1)
1624 servp = nodep->server_head;
1629 sprintf(str,
"text: \"%s\", id: \"%d\", leaf: true, icon: \"server.png\"",servp->
name, servp->
server.
pid);
1632 if(n_servers < tot_n_servers)
1655 char str[256], aux[128];
1659 int ret, n_found = 0;
1665 if(browserp->
pattern[0] !=
'\0')
1668 strcpy(pattern, browserp->
pattern);
1702 if(!strcmp(node,
"src"))
1706 sprintf(str,
"text: \"%s\", id: \"Nodes\", expanded: false",
Title);
1735 sprintf(str,
"text: \"%s\", id: \"%s\", qtip: \"%s\"",
1736 aux, nodep->name, nodep->name);
1740 printf(
"adding %s %d %d\n",nodep->name, n_nodes, tot_n_nodes);
1741 if(n_nodes < tot_n_nodes)
1754 browserp->
n_nodes = tot_n_nodes;
1763 servp = nodep->server_head;
1768 if(servp->
busy != 1)
1788 servp = nodep->server_head;
1793 strcpy(aux, servp->
name);
1794 sptr = strstr(aux,
"_SMI");
1797 sprintf(str,
"text: \"%s\", id: \"%d\", leaf: true, icon: \"server.png\", name: \"%s\"",aux, servp->
server.
pid, servp->
name);
1800 if(n_servers < tot_n_servers)
1848 char str[256], type_str[256];
1867 if(browserp->
pattern[0] !=
'\0')
1880 sprintf(str,
"text: \"%s (%d/%d services, pid %d)\"",servp->
name, n_found, n_services, servp->
server.
pid);
1892 if((!selective) || (strstr(servicep->
name, browserp->
pattern)))
1894 if(servicep->
type == 1)
1896 sprintf(type_str,
"%d@%s|%s|CMD", pid, node, servicep->
name);
1897 sprintf(str,
"text: \"%s\", id: \"%s\", leaf: true, icon: \"leaf_cmd.gif\"",servicep->
name, type_str);
1901 sprintf(type_str,
"%d@%s|%s", pid, node, servicep->
name);
1902 sprintf(str,
"text: \"%s\", id: \"%s\", leaf: true",servicep->
name, type_str);
1928 char str[512], type_str[512];
1930 int n_found = 0, n, mode_index;
1931 char aux[512], *sptr, state[512], *stptr;
1935 printf(
"prepareJSONSmiObjectList name %s\n", servp->
name);
1951 if(browserp->
pattern[0] !=
'\0')
1965 printf(
"prepareJSONSmiObjectList1 name %s\n", servp->
name);
1988 printf(
"prepareJSONSmiObjectList2 obj name %s\n", servicep->
name);
1989 if((!selective) || (strstr(servicep->
name, browserp->
pattern)))
2003 if(servicep->
status == 2)
2005 sprintf(type_str,
"%d@%s|%s", pid, node, servicep->
name);
2006 strcpy(aux, servicep->
name);
2007 sptr = strchr(aux,
'/');
2011 sptr = strchr(sptr,
'/');
2015 strcpy(state, smidomainp[i].state);
2016 stptr = strchr(state,
'/');
2023 sprintf(str,
"name: \"%s\", state: \"%s\", mode: \"%s\",id: \"%s\", leaf: true, fname: \"%s\"",
2024 sptr, state, smidomainp[mode_index].state, type_str, servicep->
name);
2052 if(strcmp(servicep->
state, data))
2054 strcpy(servicep->
state, data);
2055 tsecs =
time((time_t *)0);
2065 int n_found = 0, sid;
2104 if(servicep->
status == 2)
2112 if(servicep->
status == 2)
2127 char mode_name[256], *ptr, *ptr1, *ptr2;
2129 servicep = serviceptr;
2130 strcpy(mode_name, name);
2132 if((ptr = strstr(mode_name,
"::")))
2136 while((ptr1 = strchr(ptr1,
'/')))
2141 if(strcmp(ptr2, ptr+2))
2144 strcat(mode_name,
"_FWM");
2145 printf(
"Find SMI Mode %s %s\n",name, mode_name);
2148 if(servicep->
status == 3)
2150 if(!strcmp(servicep->
name, mode_name))
2152 printf(
"Find SMI Mode index %s %s %d\n",mode_name, servicep->
name, i);
2163 int ismode = 0, ret = 0;
2167 name = servicep->
name;
2211 switch (*wzPattern){
2216 ( *wzString &&
matchString(wzString+1, wzPattern) );
2221 return (*wzPattern == *wzString) &&
2234 size =
sizeof(long);
2242 size =
sizeof(short);
2246 size =
sizeof(float);
2250 size =
sizeof(double);
2264 int size, full_size = 0;
2266 static int last_size = 0;
2267 static void *last_buffer = 0;
2281 sscanf(ptr,
"%d", &num);
2282 full_size += size * num;
2283 if( (ptr = strchr(ptr,
';')) )
2291 if(full_size > last_size)
2295 last_buffer =
malloc((
size_t)full_size);
2296 last_size = full_size;
2298 memset(last_buffer, 0, (
size_t)last_size);
2299 buffer_ptr = last_buffer;
2307 sscanf(ptr,
"%d", &num);
2311 if( (ptr = strchr(ptr,
';')) )
2322 full_size = (int) ((
char *)buffer_ptr - (
char *)last_buffer);
2329 if((str[0] ==
'0') && (str[1] ==
'x'))
2330 sscanf(str+2,
"%x",&i);
2332 sscanf(str,
"%d",&i);
2342 else if(str[0] ==
'\"')
2344 else if((str[0] ==
'0') && (str[1] ==
'x'))
2346 sscanf(str+2,
"%x",&num);
2352 else if(isalpha(str[0]))
2356 sscanf(str,
"%d",&num);
2385 for(i = 0; i<num; i++)
2388 ptr = (
int *)ptr +1;
2389 if( (strp = strchr(strp,
' ')) )
2397 for(i = 0; i<num; i++)
2400 *((
short *)ptr) = s;
2401 ptr = (
short *)ptr +1;
2402 if( (strp = strchr(strp,
' ')) )
2410 for(i = 0; i<num; i++)
2412 sscanf(strp,
"%f",&ff);
2414 ptr = (
float *)ptr +1;
2415 if( (strp = strchr(strp,
' ')) )
2423 for(i = 0; i<num; i++)
2425 sscanf(strp,
"%f",&ff);
2427 *(
double *)ptr = dd;
2428 ptr = (
double *)ptr +1;
2429 if( (strp = strchr(strp,
' ')) )
2438 for(i = 0; i<num; i++)
2443 ptr = (
char *)ptr +1;
2444 if( (strp = strchr(strp,
' ')) )
2455 num = (int)strlen(strp)+1;
2456 strncpy((
char *)ptr,strp,(
size_t)num);
2457 if( (ptr1 = (
char *)strchr((
char *)ptr,
'\"')) )
2462 ptr = (
char *)ptr + num;
2463 if( (strp = strchr(strp,
' ')) )
char * addJSONNodeEnd(char *ptr)
#define my_ctime(t, str, size)
void print_service_standard(int *buff, int size)
int delete_browser(BROWSER *browserp)
char * getJSONSmiBuffer(char *node, int browser)
char * prepareJSONServiceList(SERVER *servp, char *node, int pid, BROWSER *browserp)
unsigned dic_info_service_stamped(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)
void dis_disable_padding()
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)
char * prepareJSONSmiObjectList(SERVER *servp, char *node, int pid, BROWSER *browserp)
int read_str_char(char *str, char *cc)
void got_update_services(BROWSER **tag, char *buffer, int *size)
void print_service_short(short *buff, int size)
int dim_set_dns_node(char *node)
struct sitem CURR_SERVICE
int findSmiModeObj(DNS_SERVICE_INFO *serviceptr, int n_services, char *name)
char * update_smi_objects(char *node, char *server, int pid, int browser)
void did_read_string(char type, int num, void **buffer_ptr, char **str_ptr)
void did_prepare_command(char *str, char *service, char *format)
int find_services(char *pattern, int conn_id, int browser, int force)
SERVER * Got_Service_List
char Curr_view_opt_par[80]
char * update_services(char *node, char *server, int pid, int browser)
char Curr_service_format[256]
char Curr_service_name[132]
void update_servers(int *tag, DNS_DID *buffer, int *size)
int check_browser_changes(char *service, int conn_id, int subscribe, int req, int browser, int force)
char * addJSONChildEnd(char *ptr, int sep)
int update_command_data(char *service, int conn_id, BROWSER *browserp)
int dic_get_quality(unsigned serv_id)
CURR_SERVICE * Curr_service_head
void get_curr_service_format()
void got_update_smi_objects(BROWSER **tag, char *buffer, int *size)
int getNodeLabel(char *name, char *label)
SLL * sll_get_next(SLL *item)
char * addJSONChildStart(char *ptr, char *child, int sep)
int prepareJSONTree(char *node, BROWSER *browserp)
int dim_get_dns_node(char *node)
int get_type_size(char type)
int did_write_string(char type, int num, void **buffer_ptr, int ssize)
char * service_format_ptr
int matchString(char *wzString, char *wzPattern)
void print_service_double(double *buff, int size)
void print_service_longlong(longlong *buff, int size)
void dtq_start_timer(int time, void(*user_routine)(), dim_long tag)
int dic_cmnd_service(char *serv_name, void *serv_address, int serv_size)
BROWSER * find_browser(int id)
void update_smi_state(OBJSTATE **tag, char *data, int *size)
int sll_insert_queue(SLL *head, SLL *item)
static char no_link_str[5]
void print_service_float(float *buff, int size)
DNS_SERVICE_INFO * service_ptr
char * addJSONEnd(char *ptr)
Warning because the service this data corrsponds to might have been last updated longer ago than Local time
void check_browser(BROWSER *tag)
char * addJSONNodeStart(char *ptr, char *node)
int sll_remove(SLL *head, SLL *item)
int did_init(char *local_node, int dns_port)
BROWSER * create_browser(int id)
void dic_disable_padding()
int prepareJSONSmiTree(char *node, BROWSER *browserp)
int find_service_pattern(NODE *nodep, SERVER *servpp, char *pattern, int *n_servers)
void prepare_browser_tree()
CURR_SERVICE * find_curr_service(char *service)
int checkSmiObjName(DNS_SERVICE_INFO *servicep)
char * addJSONStart(char *ptr)
char * getJSONBuffer(char *node, int browser)
int delete_curr_service(CURR_SERVICE *servicep)
void sendData(int conn_id, char *buffer, int type)
int web_get_node_name(char *node, char *name)
void dim_print_date_time()
SERVER * find_server(NODE *nodep, int pid)
void get_service_format(char *buffer, char *service, char *format)
int read_str_int(char *str)
void recv_service_info(void **tag, int *buffer, int *size)
void print_service_char(char *buff, int size)
int find_server_service_pattern(SERVER *servp, char *pattern)
NODE * find_node(char *node)
void dic_release_service(unsigned service_id)
DNS_SERVICE_INFO services[1]
char * dic_get_format(unsigned serv_id)
void sprintf_html(char *str, int n, int value)
sprintf(name1,"NewService%d", i)
char curr_command[MAX_NAME]
char * getJSONHeader(int isSMI)
void print_service_formatted(CURR_SERVICE *servicep, void *buff, int size)
char * Service_content_str
int update_service_data(char *service, int conn_id, int subscribe, int req, int browser, int force)
int Curr_service_print_type
char curr_smidomain[MAX_NAME]
int findSmiServices(BROWSER *browserp, SERVER *servp)
int dic_get_timestamp(unsigned serv_id, int *secs, int *milisecs)