00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00022
00023
00114 #include <stdlib.h>
00115 #include <string.h>
00116 #include <sys/types.h>
00117 #include <sys/queue.h>
00118 #include <isc/eventlib.h>
00119 #include <netinet/in.h>
00120 #include <netinet/in_systm.h>
00121 #include <netinet/ip.h>
00122 #include <netinet/udp.h>
00123 #include <netinet/ip_icmp.h>
00124 #include <jnx/aux_types.h>
00125 #include <jnx/bits.h>
00126 #include <jnx/patricia.h>
00127 #include <jnx/pconn.h>
00128 #include <jnx/junos_trace.h>
00129 #include <jnx/junos_init.h>
00130 #include "ipprobe-mt.h"
00131 #include IPPROBE_MT_OUT_H
00132 #include IPPROBE_MT_SEQUENCE_H
00133
00134 extern const parse_menu_t master_menu[];
00135
00136 static junos_sdk_app_ctx_t app_ctx;
00137
00143 static void
00144 main_exit (void)
00145 {
00146 probe_mngr_close();
00147 rspd_mngr_close();
00148 junos_destroy_app_ctx(app_ctx);
00149 exit(0);
00150 }
00151
00161 static int
00162 main_init (evContext ev_ctx)
00163 {
00164 PROBE_TRACE(PROBE_TF_NORMAL, "%s: Initializing...", __func__);
00165 probe_mngr_init(ev_ctx);
00166 rspd_mngr_init(ev_ctx);
00167 return 0;
00168 }
00169
00182 int
00183 main (int argc, char **argv)
00184 {
00185 const char *config_path[] = { "sync", "ipprobe-mt", NULL };
00186 int rc = 0;
00187
00188 app_ctx = junos_create_app_ctx(argc, argv, "ipprobe-mt",
00189 master_menu, PACKAGE_NAME, SEQUENCE_NUMBER);
00190 if (app_ctx == NULL) {
00191 return -1;
00192 }
00193
00194 rc = atexit(main_exit);
00195 if (rc < 0) {
00196 goto ret_err;
00197 }
00198 rc = junos_set_app_cb_config_read(app_ctx, config_read);
00199 if (rc < 0) {
00200 goto ret_err;
00201 }
00202
00203 rc = junos_set_app_cb_init(app_ctx, main_init);
00204 if (rc < 0) {
00205 goto ret_err;
00206 }
00207
00208 rc = junos_set_app_cfg_trace_path(app_ctx, config_path);
00209 if (rc < 0) {
00210 goto ret_err;
00211 }
00212
00213 rc = junos_app_init(app_ctx);
00214
00215 ret_err:
00216
00217
00218
00219 return rc;
00220 }
00221