counterd_main.c

Go to the documentation of this file.
00001 /*
00002  * $Id: counterd_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 
00014  
00022 /* The Application and This Daemon's Documentation: */
00023 
00063 #include <string.h>
00064 #include <isc/eventlib.h>
00065 #include <jnx/aux_types.h>
00066 #include <jnx/bits.h>
00067 #include <jnx/mgmt_sock_pub.h>
00068 #include <jnx/junos_init.h>
00069 #include <jnx/junos_kcom.h>
00070 #include "counterd_config.h"
00071 #include "counterd_kcom.h"
00072 #include "counterd_message.h"
00073 
00074 #include COUNTERD_SEQUENCE_H
00075 
00079 #define DNAME_COUNTERD    "counterd"
00080 
00081 /*** Data Structures ***/
00082 
00087 extern const parse_menu_t master_menu[];
00088 
00089 
00090 /*** STATIC/INTERNAL Functions ***/
00091 
00100 static int
00101 counterd_init(evContext ctx)
00102 {
00103     init_messages_ds();
00104     return counterd_kcom_init(ctx);
00105 }
00106 
00107 
00108 /*** GLOBAL/EXTERNAL Functions ***/
00109 
00110 
00111 
00124 int
00125 main(int argc, char ** argv)
00126 {
00127     int ret = 0;
00128     junos_sdk_app_ctx_t ctx;
00129 
00130     /* Create an application context */
00131     ctx = junos_create_app_ctx(argc, argv, DNAME_COUNTERD,
00132                                master_menu, PACKAGE_NAME, SEQUENCE_NUMBER);
00133     if (ctx == NULL) {
00134         return -1;
00135     }
00136 
00137     /* Set config read call back */
00138     if ((ret = junos_set_app_cb_config_read(ctx, counterd_config_read))) {
00139         goto cleanup;
00140     }
00141 
00142     /* Set init call back */
00143     if ((ret = junos_set_app_cb_init(ctx, counterd_init))) {
00144         goto cleanup;
00145     }
00146 
00147     /* Calling junos_app_init */
00148     ret = junos_app_init(ctx);
00149 
00150 cleanup:
00151     /* Destroying context if daemon init/exit failed */
00152     junos_destroy_app_ctx(ctx);
00153     return ret;
00154 }
00155 

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:53 2010 for SDK Your Net Corporation Counter Example 1.0 by Doxygen 1.5.1