int main(int argc, char **argv) { if (argc >= 3 && !strcmp(argv[1], "-u")) { tcpcrypt_setparam(TCPCRYPT_PARAM_CTLPATH, argv[2]); } do_netstat(); return 0; }
void __APPFUNC__ handlecmds(int cmd) { if (cmd >= 0x87 ) { /* On/offline options */ switch (cmd) { case 0x87: _DeviceOffline(HANGUP); printf("Hungup\n"); break; case 0x88: _DeviceOffline(NOHANGUP); printf("Offline\n"); break; case 0x89: _DeviceOnline(); printf("Turned device online\n"); } } else { if (process) { putchar(7); /* Beep */ return; } else { process=cmd; switch (cmd) { case 0x81: Ping(); break; case 0x82: do_netstat(); break; case 0x83: UserConfig(); break; case 0x84: exit(0); break; case 0x85: device_report(); break; case 0x86: figures(); } process=0; } } }
/** * Add IETF Port Filter attribute to the send queue */ static TNC_Result add_port_filter(imc_msg_t *msg) { pa_tnc_attr_t *attr; ietf_attr_port_filter_t *attr_port_filter; attr = ietf_attr_port_filter_create(pen_type_create(PEN_IETF, IETF_ATTR_PORT_FILTER)); attr->set_noskip_flag(attr, TRUE); attr_port_filter = (ietf_attr_port_filter_t*)attr; if (!do_netstat(attr_port_filter)) { attr->destroy(attr); return TNC_RESULT_FATAL; } msg->add_attribute(msg, attr); return TNC_RESULT_SUCCESS; }
static TNC_Result send_message(imc_msg_t *out_msg) { pa_tnc_attr_t *attr; ietf_attr_port_filter_t *attr_port_filter; attr = ietf_attr_port_filter_create(); attr->set_noskip_flag(attr, TRUE); attr_port_filter = (ietf_attr_port_filter_t*)attr; if (!do_netstat(attr_port_filter)) { attr->destroy(attr); return TNC_RESULT_FATAL; } out_msg->add_attribute(out_msg, attr); /* send PA-TNC message with the excl flag not set */ return out_msg->send(out_msg, FALSE); }