449 int j, file_fd, buflen, len;
453 static char snd_buffer[
BUFSIZE+1];
454 static char date_buffer[128];
463 printf(
"Got %s\n",
buffer);
464 if( strncmp(
buffer,
"GET ",4) && strncmp(
buffer,
"get ",4) )
480 printf(
"Got 1 %s\n",
buffer);
489 if((
int)strlen(
buffer) == 5)
491 if( !strncmp(&
buffer[0],
"GET /",5) || !strncmp(&
buffer[0],
"get /",5) )
493 (void)strcpy(
buffer,
"GET /index.html");
495 if((
int)strlen(
buffer) == 8)
497 if( !strncmp(&
buffer[0],
"GET /smi",8) || !strncmp(&
buffer[0],
"get /smi",8) )
499 (
void)strcpy(
buffer,
"GET /smi/index.html");
502 buflen=(int)strlen(
buffer);
521 printf(
"Got %s\n",
buffer);
522 if(!strncmp(&
buffer[5],
"didHeader",9))
527 else if(!strncmp(&
buffer[5],
"didData",7))
532 else if(!strncmp(&
buffer[5],
"didServices",11))
537 else if(!strncmp(&
buffer[5],
"didServiceData",14))
542 else if(!strncmp(&
buffer[5],
"didPoll",7))
547 else if(!strncmp(&
buffer[5],
"didQuery",8))
552 else if(!strncmp(&
buffer[5],
"smiData",7))
557 else if(!strncmp(&
buffer[5],
"smiObjects",10))
604 while ( (ret = (
int)read(file_fd, snd_buffer, BUFSIZE)) > 0 )
617 (void)
sprintf(snd_buffer,
"HTTP/1.1 200 OK\r\nDate: %s\r\nServer: DID/19.7\r\nContent-Length: %d\r\nContent-Type: %s\r\nConnection: close\r\n\r\n",
618 date_buffer, flen, fstr);
619 (void)
web_write(conn_id,snd_buffer,(
int)strlen(snd_buffer));
621 printf(
"SENDING to conn %d:\n%s\n",conn_id, snd_buffer);
624 while ( (ret = (
int)read(file_fd, snd_buffer, BUFSIZE)) > 0 ) {
627 printf(
"SENDING data to conn %d: %d bytes\n",conn_id, ret);
void getTime(char *buffer)
void sendSmiData(int conn_id, char *buffer, int type)
void sendData(int conn_id, char *buffer, int type)
sprintf(name1,"NewService%d", i)
void log_it(int type, char *s1, char *s2, int conn_id)