90 lines
2.5 KiB
C
90 lines
2.5 KiB
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <fcntl.h>
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
|
|
//SRC_IP=192.168.0.202&DST_IP=192.168.0.201&VIDEO_PORT=8090&SERIAL_PORT=20001%2C20002&BAUD_RATE=115200&VIDEO_RATE=8000&AUDIO_PORT=1350
|
|
|
|
int main(void){
|
|
int len;
|
|
char *lenstr,poststr[20];
|
|
char m[10],n[10];
|
|
int fd_fs;
|
|
|
|
|
|
char src_ip[50];
|
|
char dst_ip[120];
|
|
char dns_ip[120];
|
|
char gateway[120];
|
|
char video_port[120];
|
|
char serial_port_tx[50];
|
|
char serial_port_rx[50];
|
|
char baud_rate[50];
|
|
char video_rate[50];
|
|
char audio_port[50];
|
|
char switch_port[50];
|
|
char video_source[50];
|
|
char cpe_5g[50];
|
|
|
|
fd_fs = open("/root/ceshi.txt", O_RDWR | O_CREAT);
|
|
|
|
|
|
printf("Content-Type:text/html\n\n");
|
|
printf("\n");
|
|
printf("\n\n\n");
|
|
printf("\n");
|
|
printf("\n");
|
|
// lenstr=getenv("QUERY_STRING");
|
|
|
|
//printf("%s\n",lenstr);
|
|
lenstr="SRC_IP=192.168.0.203&dst_ip=rtsp://admin:sz123456@Channels/102&dns_ip=rtsp://admin:sz123456@Channels/102&gateway=rtsp://admin:sz123456@Channels/102&video_port=rtsp://admin:sz123456@Channels/102";
|
|
if(lenstr){
|
|
sscanf(lenstr,"%[^&]&%[^&]&%[^&]&%[^&]&%[^&]",src_ip,dst_ip,dns_ip,gateway,video_port);
|
|
//sscanf(lenstr,"%[^&]&%[^&]&%[^&]&%[^&]&%[^&]&%[^&]&%[^&]&%[^&]&%[^&]&%[^&]",src_ip,dst_ip,dns_ip,gateway,video_port,serial_port_tx,serial_port_rx,baud_rate,video_rate,audio_port);
|
|
|
|
printf("%s\n",src_ip);
|
|
printf("%s\n",dst_ip);
|
|
printf("%s\n",dns_ip);
|
|
printf("%s\n",gateway);
|
|
printf("%s\n",video_port);
|
|
}
|
|
|
|
if(fd_fs > 0){
|
|
write(fd_fs,src_ip,strlen(src_ip));
|
|
write(fd_fs," [\n",3);
|
|
write(fd_fs,dst_ip,strlen(dst_ip));
|
|
write(fd_fs," [\n",3);
|
|
write(fd_fs,dns_ip,strlen(dns_ip));
|
|
write(fd_fs," [\n",3);
|
|
write(fd_fs,gateway,strlen(gateway));
|
|
write(fd_fs," [\n",3);
|
|
write(fd_fs,video_port,strlen(video_port));
|
|
write(fd_fs," [\n",3);
|
|
}
|
|
#if 0
|
|
write(fd_fs,serial_port_tx,strlen(serial_port_tx));
|
|
write(fd_fs," [\n",3);
|
|
write(fd_fs,serial_port_rx,strlen(serial_port_rx));
|
|
write(fd_fs," [\n",3);
|
|
write(fd_fs,baud_rate,strlen(baud_rate));
|
|
write(fd_fs," [\n",3);
|
|
write(fd_fs,video_rate,strlen(video_rate));
|
|
write(fd_fs," [\n",3);
|
|
write(fd_fs,audio_port,strlen(audio_port));
|
|
write(fd_fs," [\n",3);
|
|
#if 0
|
|
write(fd_fs,switch_port,strlen(switch_port));
|
|
write(fd_fs," [\n",3);
|
|
write(fd_fs,video_source,strlen(video_source));
|
|
write(fd_fs," [\n",3);
|
|
write(fd_fs,cpe_5g,strlen(cpe_5g));
|
|
write(fd_fs," [\n",3);
|
|
#endif
|
|
|
|
system("cp /root/ceshi.txt /root/ConfigParameter.txt");
|
|
system("sync");
|
|
}
|
|
#endif
|
|
}
|