psd_main.c

Go to the documentation of this file.
00001 /*
00002  * $Id: psd_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 
00233 #include <sync/common.h>
00234 #include "psd_config.h"
00235 #include "psd_server.h"
00236 
00237 #include PS_OUT_H
00238 #include PS_SEQUENCE_H
00239 
00240 /*** Constants ***/
00241 
00245 #define DNAME_PSD    "psd"
00246 
00247 /*** Data Structures ***/
00248 
00253 extern const parse_menu_t master_menu[];
00254 
00255 /*** STATIC/INTERNAL Functions ***/
00256 
00265 static int
00266 psd_init(evContext ctx)
00267 {
00268     init_config(); // Initialize patricia tree.
00269     server_init(ctx); // Init the psd services server connection
00270     return SUCCESS;
00271 }
00272 
00273 /*** GLOBAL/EXTERNAL Functions ***/
00274 
00286 int
00287 main(int argc, char **argv)
00288 {
00289     int ret = 0;
00290     junos_sdk_app_ctx_t ctx;
00291     const char * psd_config[] = {DDLNAME_SYNC, DDLNAME_SYNC_PS, NULL};
00292 
00293     /* Create an application context */
00294     ctx = junos_create_app_ctx(argc, argv, DNAME_PSD,
00295                                NULL, PACKAGE_NAME, SEQUENCE_NUMBER);
00296     if (ctx == NULL) {
00297         return -1;
00298     }
00299 
00300     /* Set init call back */
00301     if ((ret = junos_set_app_cb_init(ctx, psd_init))) {
00302         goto cleanup;
00303     }
00304 
00305     /* Set config read call back */
00306     if ((ret = junos_set_app_cb_config_read(ctx, psd_config_read))) {
00307         goto cleanup;
00308     }
00309     
00310     /* set trace options DDL path */
00311     if ((ret = junos_set_app_cfg_trace_path(ctx, psd_config)) < 0) {
00312         goto cleanup;
00313     }
00314 
00315     /* Calling junos_app_init */
00316     ret = junos_app_init(ctx);
00317 
00318 cleanup:
00319     /* Destroying context if daemon init/exit failed */
00320     junos_destroy_app_ctx(ctx);
00321     return ret;
00322 }

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:07 2010 for SDK Your Net Corporation Policy Manager Example: Policy Server Daemon 1.0 by Doxygen 1.5.1