ipprobe-mt_main.c

Go to the documentation of this file.
00001 /*
00002  * $Id: ipprobe-mt_main.c 347265 2009-11-19 13:55:39Z kdickman $
00003  *
00004  * This code is provided as is by Juniper Networks SDK Developer Support.
00005  * It is provided with no warranties or guarantees, and Juniper Networks
00006  * will not provide support or maintenance of this code in any fashion.
00007  * The code is provided only to help a developer better understand how
00008  * the SDK can be used.
00009  * 
00010  * Copyright (c) 2009, Juniper Networks, Inc.
00011  * All rights reserved.
00012  */
00013 
00022 /* The Application Documentation: */
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     /* should not come here unless daemon exiting or init failed,
00217      * destroy context
00218      */
00219     return rc;
00220 }
00221 

2007-2009 Juniper Networks, Inc. All rights reserved. The information contained herein is confidential information of Juniper Networks, Inc., and may not be used, disclosed, distributed, modified, or copied without the prior written consent of Juniper Networks, Inc. in an express license. This information is subject to change by Juniper Networks, Inc. Juniper Networks, the Juniper Networks logo, and JUNOS are registered trademarks of Juniper Networks, Inc. in the United States and other countries. All other trademarks, service marks, registered trademarks, or registered service marks are the property of their respective owners.
Generated on Sun May 30 20:27:00 2010 for SDK Your Net Corporation IP Probe MT: ipprobe-mt 1.0 by Doxygen 1.5.1