helloworldd_main.c

Go to the documentation of this file.
00001 /*
00002  * $Id: helloworldd_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 
00043 #include <string.h>
00044 #include <isc/eventlib.h>
00045 #include <jnx/aux_types.h>
00046 #include <jnx/bits.h>
00047 #include <jnx/mgmt_sock_pub.h>
00048 #include <jnx/junos_init.h>
00049 #include "helloworldd_config.h"
00050 
00051 #include HELLOWORLD_SEQUENCE_H
00052 
00056 #define DNAME_HELLOWORLDD    "helloworldd"
00057 
00058 /*** Data Structures ***/
00059 
00064 extern const parse_menu_t master_menu[];
00065 
00066 
00067 /*** STATIC/INTERNAL Functions ***/
00068 
00077 static int
00078 helloworld_init (evContext ctx __unused)
00079 {
00080     init_messages_ds();
00081     return SUCCESS;
00082 }
00083 
00084 
00085 /*** GLOBAL/EXTERNAL Functions ***/
00086 
00087 
00088 
00101 int
00102 main (int argc, char ** argv)
00103 {
00104     int ret = 0;
00105     junos_sdk_app_ctx_t ctx;
00106 
00107     /* Create an application context */
00108     ctx = junos_create_app_ctx(argc, argv, DNAME_HELLOWORLDD,
00109                                master_menu, PACKAGE_NAME, SEQUENCE_NUMBER);
00110     if (ctx == NULL) {
00111         return -1;
00112     }
00113 
00114     /* Set config read call back */
00115     if ((ret = junos_set_app_cb_config_read(ctx, helloworld_config_read))) {
00116         goto cleanup;
00117     }
00118 
00119     /* Set init call back */
00120     if ((ret = junos_set_app_cb_init(ctx, helloworld_init))) {
00121         goto cleanup;
00122     }
00123 
00124     /* Calling junos_app_init */
00125     ret = junos_app_init(ctx);
00126 
00127 cleanup:
00128     /* Destroying context if daemon init/exit failed */
00129     junos_destroy_app_ctx(ctx);
00130     return ret;
00131 }
00132 

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