hellopics-mgmt_ui.c

Go to the documentation of this file.
00001 /*
00002  * $Id: hellopics-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) 2007-2008, Juniper Networks, Inc.
00011  * All rights reserved.
00012  */
00013  
00014 
00022 #include <jnx/mgmt_sock_pub.h>
00023 #include <jnx/ms_parse.h>
00024 #include <junoscript/xmlrpc.h>
00025 #include <junoscript/xmllib_pub.h>
00026 #include <ddl/defs.h>
00027 #include "hellopics-mgmt_conn.h"
00028 
00029 #include HELLOPICS_ODL_H
00030 #include HELLOPICS_OUT_H
00031 
00032 /*** Data Structures ***/
00033 
00034 extern hellopics_stats_t hellopics_stats; 
00035 
00036 // See menu structure at the bottom of this file
00037 
00038 /*** STATIC/INTERNAL Functions ***/
00039 
00054 static int32_t
00055 hellopics_show_stats (mgmt_sock_t *msp,
00056                         parse_status_t *csb __unused,
00057                         char *unparsed __unused)
00058 {
00059     XML_OPEN(msp, ODCI_HELLOPICS_STATISTICS);
00060 
00061     XML_ELT(msp, ODCI_CYCLES_SENT, "%d", hellopics_stats.msgs_sent);
00062     XML_ELT(msp, ODCI_CYCLES_RECEIVED, "%d", hellopics_stats.msgs_received);
00063     XML_ELT(msp, ODCI_CYCLES_MISSED, "%d", hellopics_stats.msgs_missed);
00064     XML_ELT(msp, ODCI_CYCLES_OUT_OF_ORDER, "%d", hellopics_stats.msgs_badorder);
00065 
00066     XML_CLOSE(msp, ODCI_HELLOPICS_STATISTICS);
00067     
00068     return 0;
00069 }
00070 
00071 
00072 /*** GLOBAL/EXTERNAL Functions ***/
00073 
00074 
00075 
00076 /******************************************************************************
00077  *                        Menu Structure
00078  *****************************************************************************/
00079 
00080 /*
00081  * format (from libjuniper's ms_parse.h):
00082  *   command,
00083  *   help desc (or NULL),
00084  *   user data arg block (or 0),
00085  *   child (next) menu (or NULL),
00086  *   handler for command(or 0)
00087  */
00088 
00092 static const parse_menu_t show_sync_hellopics_menu[] = {
00093     { "statistics", NULL, 0, NULL, hellopics_show_stats },
00094     { NULL, NULL, 0, NULL, NULL }
00095 };
00096 
00100 static const parse_menu_t show_sync_menu[] = {
00101     { "hellopics", NULL, 0, show_sync_hellopics_menu, NULL },
00102     { NULL, NULL, 0, NULL, NULL }
00103 };
00104 
00108 static const parse_menu_t show_menu[] = {
00109     { "sync", NULL, 0, show_sync_menu, NULL },
00110     { NULL, NULL, 0, NULL, NULL }
00111 };
00112 
00116 const parse_menu_t master_menu[] = {
00117     { "show", NULL, 0, show_menu, NULL },
00118     { NULL, NULL, 0, NULL, NULL }
00119 };
00120 

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-mgmt 1.0 by Doxygen 1.5.1