dpm-mgmt_ui.c

Go to the documentation of this file.
00001 /*
00002  * $Id: dpm-mgmt_ui.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) 2008, Juniper Networks, Inc.
00011  * All rights reserved.
00012  */
00013  
00014 
00022 #include <sync/common.h>
00023 #include <junoscript/xmllib_pub.h>
00024 #include <junoscript/xmlrpc.h>
00025 #include <ddl/defs.h>
00026 #include "dpm-mgmt_main.h"
00027 #include "dpm-mgmt_config.h"
00028 #include "dpm-mgmt_conn.h"
00029 #include "dpm-mgmt_logging.h"
00030 
00031 #include DPM_ODL_H
00032 #include DPM_OUT_H
00033 
00034 /*** Constants ***/
00035 
00036 
00037 /*** Data Structures ***/
00038 
00039 extern class_list_t logged_in;
00040 
00041 // See menu structure at the bottom of this file
00042 
00043 
00044 /*** STATIC/INTERNAL Functions ***/
00045 
00046 
00061 static int32_t
00062 dpm_show_subs(mgmt_sock_t * msp,
00063               parse_status_t * csb __unused,
00064               char * unparsed __unused)
00065 {
00066     login_class_t * lc;
00067     login_sub_t * ls;
00068     
00069     XML_OPEN(msp, ODCI_DPM_SUBSCRIBERS);
00070 
00071     // go thru classes
00072     lc = TAILQ_FIRST(&logged_in);
00073     while(lc != NULL) {
00074         
00075         XML_OPEN(msp, ODCI_CLASS);
00076         XML_ELT(msp, ODCI_CLASS_NAME, "%s", lc->class);        
00077         XML_OPEN(msp, ODCI_SUBSCRIBERS);
00078         
00079         // go thru subscribers
00080         ls = TAILQ_FIRST(&lc->subs);
00081         while(ls != NULL) {
00082             XML_ELT(msp, ODCI_SUBSCRIBER, "%s", ls->name);
00083             ls = TAILQ_NEXT(ls, entries);      
00084         }
00085         
00086         XML_CLOSE(msp, ODCI_SUBSCRIBERS);
00087         XML_CLOSE(msp, ODCI_CLASS);
00088         
00089         lc = TAILQ_NEXT(lc, entries);
00090     }
00091     
00092     XML_CLOSE(msp, ODCI_DPM_SUBSCRIBERS);
00093     
00094     return 0;
00095 }
00096 
00097 
00098 /*** GLOBAL/EXTERNAL Functions ***/
00099 
00100 
00101 
00102 /******************************************************************************
00103  *                        Menu Structure
00104  *****************************************************************************/
00105 
00106 /*
00107  * format (from libjuniper's ms_parse.h):
00108  *   command,
00109  *   help desc (or NULL),
00110  *   user data arg block (or 0),
00111  *   child (next) menu (or NULL),
00112  *   handler for command(or 0)
00113  */
00114 
00115 
00119 static const parse_menu_t show_sync_dpm_menu[] = {
00120     { "subscribers", NULL, 0, NULL, dpm_show_subs },
00121     { NULL, NULL, 0, NULL, NULL }
00122 };
00123 
00127 static const parse_menu_t show_sync_menu[] = {
00128     { "dpm", NULL, 0, show_sync_dpm_menu, NULL },
00129     { NULL, NULL, 0, NULL, NULL }
00130 };
00131 
00135 static const parse_menu_t show_menu[] = {
00136     { "sync", NULL, 0, show_sync_menu, NULL },
00137     { NULL, NULL, 0, NULL, NULL }
00138 };
00139 
00143 const parse_menu_t master_menu[] = {
00144     { "show", NULL, 0, show_menu, NULL }, 
00145     { NULL, NULL, 0, NULL, NULL }
00146 };
00147 

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:55 2010 for SDK Your Net Corporation Dynamic Policy Manager Example: dpm-mgmt 1.0 by Doxygen 1.5.1