hellopics-data_main.c

Go to the documentation of this file.
00001 /*
00002  * $Id: hellopics-data_main.c 346460 2009-11-14 05:06:47Z ssiano $
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) 2007-2008, Juniper Networks, Inc.
00011  * All rights reserved.
00012  */
00013 
00021 /* The Application and This Daemon's Documentation: */
00022 
00073 #include <string.h>
00074 #include <signal.h>
00075 #include <sys/types.h>
00076 #include <isc/eventlib.h>
00077 #include <jnx/mpsdk.h>
00078 #include <jnx/aux_types.h>
00079 #include "hellopics-data_conn.h"
00080 
00081 /*** Constants ***/
00082 
00086 #define DNAME_HELLOPICS_DATA    "hellopics-data"
00087 
00088 /*** Data Structures ***/
00089 
00090 
00091 /*** STATIC/INTERNAL Functions ***/
00092 
00093 
00097 static void 
00098 hellopics_data_quit(int signo __unused)
00099 {
00100     close_connections();
00101     msp_exit();
00102 }
00103 
00104 
00113 static int
00114 hellopics_data_init (evContext ctx)
00115 {
00116     msp_init();
00117     
00118     // Handle some signals that we may receive:
00119     msp_sig_register(SIGTERM, hellopics_data_quit); // call quit fnc
00120     signal(SIGHUP, SIG_IGN); // ignore
00121     signal(SIGPIPE, SIG_IGN); // ignore
00122     
00123     return init_connections(ctx);
00124 }
00125 
00126 
00127 /*** GLOBAL/EXTERNAL Functions ***/
00128 
00129 
00142 int
00143 main(int32_t argc , char **argv)
00144 {
00145     mp_sdk_app_ctx_t app_ctx;
00146     int rc;
00147 
00148     app_ctx = msp_create_app_ctx(argc, argv, DNAME_HELLOPICS_DATA);
00149     msp_set_app_cb_init(app_ctx, hellopics_data_init);
00150 
00151     rc = msp_app_init(app_ctx);
00152 
00153     /* Should never reach this point */
00154     msp_destroy_app_ctx(app_ctx);
00155     return rc;
00156 }
00157 

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:26:58 2010 for SDK Your Net Corporation Hellopics Example: hellopics-data 1.0 by Doxygen 1.5.1