Changeset 1691 for trunk/module-monitor.c
- Timestamp:
- 02/25/10 21:46:37 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/module-monitor.c
r1617 r1691 7 7 #endif 8 8 9 static int auth=0;9 static int auth = 0; 10 10 11 11 static void monitor_check_ip() … … 208 208 { 209 209 if (btxt[0]) monitor_send(btxt); 210 strncpy(btxt, txt, sizeof(btxt));210 cs_strncpy(btxt, txt, sizeof(btxt)); 211 211 return; 212 212 } … … 216 216 monitor_send(btxt); 217 217 txt[2]='E'; 218 strncpy(btxt, txt, sizeof(btxt));218 cs_strncpy(btxt, txt, sizeof(btxt)); 219 219 } 220 220 else 221 221 { 222 222 if (txt) 223 strncpy(btxt, txt, sizeof(btxt));223 cs_strncpy(btxt, txt, sizeof(btxt)); 224 224 btxt[2]=(btxt[2]=='B') ? 'S' : 'E'; 225 225 } … … 233 233 } 234 234 235 int cs_idx2ridx(int idx) 236 { 237 int i; 238 for (i=0; i<CS_MAXREADER; i++) 239 if (reader[i].cs_idx==idx) 240 return(i); 241 return(-1); 235 int cs_idx2ridx(int idx){ 236 int i; 237 for (i = 0; i < CS_MAXREADER; i++) 238 if (reader[i].cs_idx==idx) 239 return(i); 240 return(-1); 242 241 } 243 242 … … 251 250 for (i=0; i<this->ncaid; i++) 252 251 if (this->caid[i] == caid) 253 strncpy(name, this->name, 32);252 cs_strncpy(name, this->name, 32); 254 253 255 254 if (!name[0]) sprintf(name, "[%04X:%04X]", caid, srvid); … … 299 298 } 300 299 301 static char *monitor_client_info(char id, int i) 302 { 303 static char sbuf[256]; 304 305 sbuf[0]='\0'; 306 if (client[i].pid) 307 { 308 char ldate[16], ltime[16], *usr; 309 int lsec, isec, cnr, con, cau; 310 time_t now; 311 struct tm *lt; 312 now=time((time_t)0); 313 314 if ((cfg->mon_hideclient_to <= 0) || 315 (((now-client[i].lastemm)/60)<cfg->mon_hideclient_to) || 316 (client[i].typ!='c')) 317 { 318 lsec=now-client[i].login; 319 isec=now-client[i].last; 320 usr=client[i].usr; 321 if (((client[i].typ=='r') || (client[i].typ=='p')) && 322 (con=cs_idx2ridx(i))>=0) 323 usr=reader[con].label; 324 if (client[i].dup) 325 con=2; 326 else 327 if ((client[i].tosleep) && 328 (now-client[i].lastswitch>client[i].tosleep)) 329 con=1; 330 else 331 con=0; 332 if (i-cdiff>0) 333 cnr=i-cdiff; 334 else 335 cnr=(i>1) ? i-1 : 0; 336 if( (cau=client[i].au+1) ) 337 if ((now-client[i].lastemm)/60>cfg->mon_aulow) 338 cau=-cau; 339 lt=localtime(&client[i].login); 340 sprintf(ldate, "%2d.%02d.%02d", 341 lt->tm_mday, lt->tm_mon+1, lt->tm_year % 100); 342 sprintf(ltime, "%2d:%02d:%02d", 343 lt->tm_hour, lt->tm_min, lt->tm_sec); 344 sprintf(sbuf, "[%c--CCC]%d|%c|%d|%s|%d|%d|%s|%d|%s|%s|%s|%d|%04X:%04X|%s|%d|%d\n", 345 id, client[i].pid, client[i].typ, cnr, usr, cau, client[i].crypted, 346 cs_inet_ntoa(client[i].ip), client[i].port, monitor_get_proto(i), 347 ldate, ltime, lsec, client[i].last_caid, client[i].last_srvid, 348 monitor_get_srvname(client[i].last_srvid, client[i].last_caid), isec, con); 349 } 350 } 351 return(sbuf); 300 static char *monitor_client_info(char id, int i){ 301 static char sbuf[256]; 302 sbuf[0] = '\0'; 303 304 if (client[i].pid){ 305 char ldate[16], ltime[16], *usr; 306 int lsec, isec, cnr, con, cau; 307 time_t now; 308 struct tm *lt; 309 now=time((time_t)0); 310 311 if ((cfg->mon_hideclient_to <= 0) || 312 (now-client[i].lastecm < cfg->mon_hideclient_to) || 313 (now-client[i].lastemm < cfg->mon_hideclient_to) || 314 (client[i].typ != 'c')) 315 { 316 lsec=now-client[i].login; 317 isec=now-client[i].last; 318 usr=client[i].usr; 319 if (((client[i].typ == 'r') || (client[i].typ == 'p')) && (con=cs_idx2ridx(i)) >= 0) 320 usr=reader[con].label; 321 if (client[i].dup) 322 con=2; 323 else 324 if ((client[i].tosleep) && (now-client[i].lastswitch>client[i].tosleep)) 325 con = 1; 326 else 327 con = 0; 328 if (i - cdiff > 0) 329 cnr = i - cdiff; 330 else 331 cnr=(i > 1) ? i - 1 : 0; 332 if( (cau = client[i].au + 1) ) 333 if ((now-client[i].lastemm) /60 > cfg->mon_aulow) 334 cau=-cau; 335 lt = localtime(&client[i].login); 336 sprintf(ldate, "%2d.%02d.%02d", lt->tm_mday, lt->tm_mon+1, lt->tm_year % 100); 337 sprintf(ltime, "%2d:%02d:%02d", lt->tm_hour, lt->tm_min, lt->tm_sec); 338 sprintf(sbuf, "[%c--CCC]%d|%c|%d|%s|%d|%d|%s|%d|%s|%s|%s|%d|%04X:%04X|%s|%d|%d\n", 339 id, client[i].pid, client[i].typ, cnr, usr, cau, client[i].crypted, 340 cs_inet_ntoa(client[i].ip), client[i].port, monitor_get_proto(i), 341 ldate, ltime, lsec, client[i].last_caid, client[i].last_srvid, 342 monitor_get_srvname(client[i].last_srvid, client[i].last_caid), isec, con); 343 } 344 } 345 return(sbuf); 352 346 } 353 347 … … 372 366 } 373 367 monitor_send_info(NULL, 1); 374 } 375 376 static void monitor_send_details(char *txt, int pid) 377 { 378 char buf[256]; 379 snprintf(buf, 255, "[D-----]%d|%s\n", pid, txt); 380 monitor_send_info(buf, 0); 381 } 382 383 static void monitor_send_details_version() 384 { 385 char buf[256]; 386 sprintf(buf, "[A-0000]version=%s, build=%s, system=%s%s", CS_VERSION_X, CS_SVN_VERSION, cs_platform(buf+100), buf+200); 387 monitor_send_info(buf, 1); 388 } 389 390 static void monitor_process_details_master(char *buf, int pid) 391 { 392 if (cfg->nice!=99) 393 sprintf(buf+200, ", nice=%d", cfg->nice); 394 else 395 buf[200]='\0'; 396 sprintf(buf, "version=%s#%s, system=%s%s", CS_VERSION_X, CS_SVN_VERSION, cs_platform(buf+100), buf+200); 397 monitor_send_details(buf, pid); 398 399 sprintf(buf, "max. clients=%d, client max. idle=%ld sec", CS_MAXPID-2, cfg->cmaxidle); 400 monitor_send_details(buf, pid); 401 402 if( cfg->max_log_size ) 403 sprintf(buf+200, "%d Kb", cfg->max_log_size); 404 else 405 strcpy(buf+200, "unlimited"); 406 sprintf(buf, "max. logsize=%s", buf+200); 407 monitor_send_details(buf, pid); 408 409 sprintf(buf, "client timeout=%lu ms, cache delay=%ld ms", cfg->ctimeout, cfg->delay); 410 monitor_send_details(buf, pid); 368 } 369 370 static void monitor_send_details(char *txt, int pid){ 371 char buf[256]; 372 snprintf(buf, 255, "[D-----]%d|%s\n", pid, txt); 373 monitor_send_info(buf, 0); 374 } 375 376 static void monitor_send_details_version(){ 377 char buf[256]; 378 sprintf(buf, "[V-0000]version=%s, build=%s, system=%s%s\n", CS_VERSION_X, CS_SVN_VERSION, cs_platform(buf + 100), buf + 200); 379 monitor_send_info(buf, 1); 380 } 381 382 static void monitor_process_details_master(char *buf, int pid){ 383 if (cfg->nice != 99) 384 sprintf(buf + 200, ", nice=%d", cfg->nice); 385 else 386 buf[200] = '\0'; 387 sprintf(buf, "version=%s#%s, system=%s%s", CS_VERSION_X, CS_SVN_VERSION, cs_platform(buf + 100), buf + 200); 388 monitor_send_details(buf, pid); 389 390 sprintf(buf, "max. clients=%d, client max. idle=%ld sec", CS_MAXPID - 2, cfg->cmaxidle); 391 monitor_send_details(buf, pid); 392 393 if( cfg->max_log_size ) 394 sprintf(buf + 200, "%d Kb", cfg->max_log_size); 395 else 396 strcpy(buf + 200, "unlimited"); 397 sprintf(buf, "max. logsize=%s", buf + 200); 398 monitor_send_details(buf, pid); 399 400 sprintf(buf, "client timeout=%lu ms, cache delay=%ld ms", cfg->ctimeout, cfg->delay); 401 monitor_send_details(buf, pid); 411 402 412 403 //#ifdef CS_NOSHM … … 419 410 420 411 #ifdef CS_RDR_INIT_HIST 421 static void monitor_process_details_reader(int pid, int idx) 422 { 423 int r_idx; 424 char *p; 425 if ((r_idx=cs_idx2ridx(idx))>=0) 426 for (p=(char *)reader[r_idx].init_history; *p; p+=strlen(p)+1) 427 monitor_send_details(p, pid); 428 else 429 monitor_send_details("Missing reader index !", pid); 412 static void monitor_process_details_reader(int pid, int idx){ 413 int r_idx; 414 char *p; 415 if ((r_idx=cs_idx2ridx(idx))>=0) 416 for (p=(char *)reader[r_idx].init_history; *p; p+=strlen(p)+1) 417 monitor_send_details(p, pid); 418 else 419 monitor_send_details("Missing reader index !", pid); 430 420 } 431 421 #endif 432 422 433 static void monitor_process_details(char *arg) 434 { 435 int pid, idx; 436 char sbuf[256]; 437 if (!arg) return; 438 if ((idx=idx_from_pid(pid=atoi(arg)))<0) 439 monitor_send_details("Invalid PID", pid); 440 else 441 { 442 monitor_send_info(monitor_client_info('D', idx), 0); 443 switch(client[idx].typ) 444 { 445 case 's': 446 monitor_process_details_master(sbuf, pid); 447 break; 448 case 'c': case 'm': 449 break; 450 case 'r': 423 static void monitor_process_details(char *arg){ 424 int pid, idx; 425 char sbuf[256]; 426 if (!arg) return; 427 if ((idx = idx_from_pid(pid = atoi(arg))) < 0) 428 monitor_send_details("Invalid PID", pid); 429 else 430 { 431 monitor_send_info(monitor_client_info('D', idx), 0); 432 switch(client[idx].typ) 433 { 434 case 's': 435 monitor_process_details_master(sbuf, pid); 436 break; 437 case 'c': case 'm': 438 break; 439 case 'r': 451 440 #ifdef CS_RDR_INIT_HIST 452 441 monitor_process_details_reader(pid, idx); 453 442 #endif 454 break; 455 case 'p': 456 break; 457 } 458 } 459 monitor_send_info(NULL, 1); 460 } 461 462 static void monitor_send_login(void) 463 { 464 char buf[64]; 465 if (auth) 466 sprintf(buf, "[A-0000]1|%s logged in\n", client[cs_idx].usr); 467 else 468 strcpy(buf, "[A-0000]0|not logged in\n"); 469 monitor_send_info(buf, 1); 470 } 471 472 static void monitor_login(char *usr) 473 { 474 char *pwd=NULL; 475 if ((usr) && (pwd=strchr(usr, ' '))) 476 *pwd++=0; 477 if (pwd) 478 monitor_auth_client(trim(usr), trim(pwd)); 479 else 480 monitor_auth_client(NULL, NULL); 481 monitor_send_login(); 482 } 483 484 static void monitor_logsend(char *flag) 485 { 443 break; 444 case 'p': 445 break; 446 } 447 } 448 monitor_send_info(NULL, 1); 449 } 450 451 static void monitor_send_login(void){ 452 char buf[64]; 453 if (auth) 454 sprintf(buf, "[A-0000]1|%s logged in\n", client[cs_idx].usr); 455 else 456 strcpy(buf, "[A-0000]0|not logged in\n"); 457 monitor_send_info(buf, 1); 458 } 459 460 static void monitor_login(char *usr){ 461 char *pwd=NULL; 462 if ((usr) && (pwd=strchr(usr, ' '))) 463 *pwd++=0; 464 if (pwd) 465 monitor_auth_client(trim(usr), trim(pwd)); 466 else 467 monitor_auth_client(NULL, NULL); 468 monitor_send_login(); 469 } 470 471 static void monitor_logsend(char *flag){ 486 472 #ifdef CS_LOGHISTORY 487 473 int i; 488 474 #endif 489 490 491 492 493 494 495 496 497 475 if (strcmp(flag, "on")) { 476 if (strcmp(flag, "onwohist")) { 477 client[cs_idx].log=0; 478 return; 479 } 480 } 481 482 if (client[cs_idx].log) // already on 483 return; 498 484 #ifdef CS_LOGHISTORY 499 if (!strcmp(flag, "on")){ 500 for (i=(*loghistidx+3) % CS_MAXLOGHIST; i!=*loghistidx; i=(i+1) % CS_MAXLOGHIST) 501 { 502 char *p_usr, *p_txt; 503 p_usr=(char *)(loghist+(i*CS_LOGHISTSIZE)); 504 p_txt=p_usr+32; 505 if ((p_txt[0]) && 506 ((client[cs_idx].monlvl>1) || (!strcmp(p_usr, client[cs_idx].usr)))) 507 { 508 char sbuf[8]; 509 sprintf(sbuf, "%03d", client[cs_idx].logcounter); 510 client[cs_idx].logcounter=(client[cs_idx].logcounter+1) % 1000; 511 memcpy(p_txt+4, sbuf, 3); 512 monitor_send(p_txt); 513 } 514 } 515 } 485 if (!strcmp(flag, "on")){ 486 for (i = (*loghistidx + 3) % CS_MAXLOGHIST; i != *loghistidx; i = (i + 1) % CS_MAXLOGHIST){ 487 char *p_usr, *p_txt; 488 p_usr=(char *)(loghist+(i*CS_LOGHISTSIZE)); 489 p_txt = p_usr + 32; 490 if ((p_txt[0]) && ((client[cs_idx].monlvl > 1) || (!strcmp(p_usr, client[cs_idx].usr)))) { 491 char sbuf[8]; 492 sprintf(sbuf, "%03d", client[cs_idx].logcounter); 493 client[cs_idx].logcounter=(client[cs_idx].logcounter + 1) % 1000; 494 memcpy(p_txt + 4, sbuf, 3); 495 monitor_send(p_txt); 496 } 497 } 498 } 516 499 #endif 517 client[cs_idx].log=1; 518 } 519 static void monitor_set_debuglevel(char *flag) 520 { 521 cs_dblevel^=atoi(flag); 522 kill(client[0].pid, SIGUSR1); 500 client[cs_idx].log=1; 501 } 502 503 static void monitor_set_debuglevel(char *flag){ 504 cfg->debuglvl = atoi(flag); 505 kill(client[0].pid, SIGUSR1); 506 } 507 508 static void monitor_set_account(char *args){ 509 struct s_auth *account; 510 char delimiter[] = " ="; 511 char *ptr; 512 int argidx, i, found; 513 char *argarray[3]; 514 char *token[]={"au", "sleep", "uniq", "monlevel", "group", "services", "betatunnel", "ident", "caid", "chid", "class", "hostname", "refresh"}; 515 int tokencnt = sizeof(token)/sizeof(char *); 516 char buf[256]; 517 518 argidx = 0; 519 found = 0; 520 521 ptr = strtok(args, delimiter); 522 523 // resolve arguments 524 while(ptr != NULL) { 525 argarray[argidx]=trim(ptr); 526 ptr = strtok(NULL, delimiter); 527 argidx++; 528 } 529 530 if(!strcmp(argarray[1], "refresh")){ 531 kill(client[0].pid, SIGHUP); 532 }else{ 533 if(argidx != 3) { 534 sprintf(buf, "[S-0000]setuser failed - wrong number of parameters (%d)\n", argidx); 535 monitor_send_info(buf, 1); 536 return; 537 } 538 } 539 540 //search account 541 for (account=cfg->account; (account) ; account=account->next){ 542 if (!strcmp(argarray[0], account->usr)){ 543 found=1; 544 break; 545 } 546 } 547 548 if (found != 1){ 549 sprintf(buf, "[S-0000]setuser failed - user %s not found\n", argarray[0]); 550 monitor_send_info(buf, 1); 551 return; 552 } 553 554 found = 0; 555 for (i = 0; i < tokencnt; i++){ 556 if (!strcmp(argarray[1], token[i])){ 557 // preparing the parameters before re-load 558 switch(i) { 559 560 case 6: clear_tuntab(&account->ttab); break; //betatunnel 561 562 case 8: clear_caidtab(&account->ctab); break; //Caid 563 564 565 566 567 } 568 found = 1; 569 } 570 } 571 572 if (found != 1){ 573 sprintf(buf, "[S-0000]setuser failed - parameter %s not exist", argarray[1]); 574 monitor_send_info(buf, 1); 575 return; 576 } else { 577 chk_account(token[i],argarray[2],account); 578 } 579 580 cs_reinit_clients(); 581 582 sprintf(buf, "[S-0000]setuser %s done - param %s set to %s\n", argarray[0], argarray[1], argarray[2]); 583 monitor_send_info(buf, 1); 584 } 585 586 static void monitor_set_server(char *args){ 587 char delimiter[] = "="; 588 char *ptr; 589 int argidx, i, found; 590 char *argarray[3]; 591 char *token[]={"clienttimeout", "fallbacktimeout", "clientmaxidle", "cachedelay", "bindwait", "netprio", "resolvedelay", "sleep", "unlockparental", "serialreadertimeout", "maxlogsize", "showecmdw", "waitforcards", "preferlocalcards"}; 592 char buf[256]; 593 594 argidx=0; found=0; 595 ptr = strtok(args, delimiter); 596 597 // resolve arguments 598 while(ptr != NULL) { 599 argarray[argidx]=trim(ptr); 600 ptr = strtok(NULL, delimiter); 601 argidx++; 602 } 603 604 if(argidx != 2) { 605 sprintf(buf, "[S-0000]setserver failed - wrong number of parameters (%d)\n", argidx); 606 monitor_send_info(buf, 1); 607 return; 608 } 609 610 trim(argarray[0]); 611 trim(argarray[1]); 612 strtolower(argarray[0]); 613 614 for (i = 0; i < 14; i++) 615 if (!strcmp(argarray[0], token[i])) break; 616 617 if (i < 14){ 618 chk_t_global(token[i],argarray[1]); 619 sprintf(buf, "[S-0000]setserver done - param %s set to %s\n", argarray[0], argarray[1]); 620 monitor_send_info(buf, 1); 621 } else { 622 sprintf(buf, "[S-0000]setserver failed - parameter %s not exist", argarray[0]); 623 monitor_send_info(buf, 1); 624 return; 625 } 626 627 if (cfg->ftimeout>=cfg->ctimeout) { 628 cfg->ftimeout = cfg->ctimeout - 100; 629 sprintf(buf, "[S-0000]setserver WARNING: fallbacktimeout adjusted to %lu ms", cfg->ftimeout); 630 monitor_send_info(buf, 1); 631 } 632 if(cfg->ftimeout < cfg->srtimeout) { 633 cfg->ftimeout = cfg->srtimeout + 100; 634 sprintf(buf, "[S-0000]setserver WARNING: fallbacktimeout adjusted to %lu ms", cfg->ftimeout); 635 monitor_send_info(buf, 1); 636 } 637 if(cfg->ctimeout < cfg->srtimeout) { 638 cfg->ctimeout = cfg->srtimeout + 100; 639 sprintf(buf, "[S-0000]setserver WARNING: clienttimeout adjusted to %lu ms", cfg->ctimeout); 640 monitor_send_info(buf, 1); 641 } 642 //kill(client[0].pid, SIGUSR1); 523 643 } 524 644 525 645 static int monitor_process_request(char *req) 526 646 { 527 int i, rc; 528 char *cmd[]={"login", "exit", "log", "status", "shutdown", "reload", "details", "version", "debug"}; 529 char *arg; 530 if( (arg=strchr(req, ' ')) ) 531 { 532 *arg++=0; 533 trim(arg); 534 } 535 trim(req); 536 if ((!auth) && (strcmp(req, cmd[0]))) 537 monitor_login(NULL); 538 for (rc=1, i=0; i<9; i++) 539 if (!strcmp(req, cmd[i])) 540 { 541 switch(i) 542 { 543 case 0: monitor_login(arg); break; // login 544 case 1: rc=0; break; // exit 545 case 2: monitor_logsend(arg); break; // log 546 case 3: monitor_process_info(); break; // status 547 case 4: if (client[cs_idx].monlvl>3) 548 kill(client[0].pid, SIGQUIT); // shutdown 549 break; 550 case 5: if (client[cs_idx].monlvl>2) 551 kill(client[0].pid, SIGHUP); // reload 552 break; 553 case 6: monitor_process_details(arg); break; // details 554 case 7: monitor_send_details_version(); break; 555 case 8: if (client[cs_idx].monlvl>3) 556 monitor_set_debuglevel(arg); // debuglevel 557 break; 558 default: continue; 559 } 560 break; 561 } 562 return(rc); 563 } 564 565 static void monitor_server() 566 { 567 int n; 568 client[cs_idx].typ='m'; 569 while (((n=process_input(mbuf, sizeof(mbuf), cfg->cmaxidle))>=0) && 570 monitor_process_request((char *)mbuf)); 571 cs_disconnect_client(); 572 } 573 574 void module_monitor(struct s_module *ph) 575 { 576 static PTAB ptab; 577 ptab.ports[0].s_port = cfg->mon_port; 578 ph->ptab = &ptab; 579 ph->ptab->nports = 1; 580 581 if (cfg->mon_aulow<1) 582 cfg->mon_aulow=30; 583 strcpy(ph->desc, "monitor"); 584 ph->type=MOD_CONN_UDP; 585 ph->multi=0; 586 ph->watchdog=1; 587 ph->s_ip=cfg->mon_srvip; 588 ph->s_handler=monitor_server; 589 ph->recv=monitor_recv; 647 int i, rc; 648 char *cmd[] = {"login", "exit", "log", "status", "shutdown", "reload", "details", "version", "debug", "setuser", "setserver"}; 649 int cmdcnt = sizeof(cmd)/sizeof(char *); // Calculate the amount of items in array 650 char *arg; 651 652 if( (arg = strchr(req, ' ')) ) { *arg++ = 0; trim(arg); } 653 //trim(req); 654 if ((!auth) && (strcmp(req, cmd[0]))) monitor_login(NULL); 655 656 for (rc=1, i = 0; i < cmdcnt; i++) 657 if (!strcmp(req, cmd[i])) { 658 switch(i) { 659 case 0: monitor_login(arg); break; // login 660 case 1: rc=0; break; // exit 661 case 2: monitor_logsend(arg); break; // log 662 case 3: monitor_process_info(); break; // status 663 case 4: if (client[cs_idx].monlvl > 3) kill(client[0].pid, SIGQUIT); break; // shutdown 664 case 5: if (client[cs_idx].monlvl > 2) kill(client[0].pid, SIGHUP); break; // reload 665 case 6: monitor_process_details(arg); break; // details 666 case 7: monitor_send_details_version(); break; // version 667 case 8: if (client[cs_idx].monlvl > 3) monitor_set_debuglevel(arg); break; // debuglevel 668 case 9: if (client[cs_idx].monlvl > 3) monitor_set_account(arg); break; // setuser 669 case 10: if (client[cs_idx].monlvl > 3) monitor_set_server(arg); break; // setserver 670 default: continue; 671 } 672 break; 673 } 674 return(rc); 675 } 676 677 static void monitor_server(){ 678 int n; 679 client[cs_idx].typ='m'; 680 while (((n = process_input(mbuf, sizeof(mbuf), cfg->cmaxidle)) >= 0) && monitor_process_request((char *)mbuf)); 681 cs_disconnect_client(); 682 } 683 684 void module_monitor(struct s_module *ph){ 685 static PTAB ptab; 686 ptab.ports[0].s_port = cfg->mon_port; 687 ph->ptab = &ptab; 688 ph->ptab->nports = 1; 689 690 if (cfg->mon_aulow < 1) 691 cfg->mon_aulow = 30; 692 strcpy(ph->desc, "monitor"); 693 ph->type=MOD_CONN_UDP; 694 ph->multi = 0; 695 ph->watchdog = 1; 696 ph->s_ip = cfg->mon_srvip; 697 ph->s_handler = monitor_server; 698 ph->recv = monitor_recv; 590 699 // ph->send_dcw=NULL; 591 700 } 701 702
Note:
See TracChangeset
for help on using the changeset viewer.