counterd_ui.c

Go to the documentation of this file.
00001 /*
00002  * $Id: counterd_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 
00021 #include <jnx/mgmt_sock_pub.h>
00022 #include <jnx/ms_parse.h>
00023 #include <junoscript/xmlrpc.h>
00024 #include <junoscript/xmllib_pub.h>
00025 #include <ddl/defs.h>
00026 #include "counterd_config.h"
00027 #include "counterd_message.h"
00028 
00029 #include COUNTERD_ODL_H
00030 #include COUNTERD_OUT_H
00031 
00032 /*** Data Structures ***/
00033 
00034 // See menu structure at the bottom of this file
00035 
00036 /*** STATIC/INTERNAL Functions ***/
00037 
00052 static int32_t
00053 counterd_show_messages (mgmt_sock_t *msp,
00054                         parse_status_t *csb __unused,
00055                         char *unparsed __unused)
00056 {
00057     XML_OPEN(msp, ODCI_COUNTER_MESSAGES);
00058 
00059     XML_ELT(msp, ODCI_MESSAGE, "%s", get_message());
00060     
00061     XML_ELT(msp, ODCI_COUNT, "%d", get_times_viewed());    
00062 
00063     XML_CLOSE(msp, ODCI_COUNTER_MESSAGES);
00064     
00065     return 0;
00066 }
00067 
00068 
00069 /*** GLOBAL/EXTERNAL Functions ***/
00070 
00071 
00072 /******************************************************************************
00073  *                        Menu Structure
00074  *****************************************************************************/
00075 
00076 /*
00077  * format (from libjuniper's ms_parse.h):
00078  *   command,
00079  *   help desc (or NULL),
00080  *   user data arg block (or 0),
00081  *   child (next) menu (or NULL),
00082  *   handler for command(or 0)
00083  */
00084 
00088 static const parse_menu_t show_sync_counter_menu[] = {
00089     { "message", NULL, 0, NULL, counterd_show_messages },
00090     { NULL, NULL, 0, NULL, NULL }
00091 };
00092 
00096 static const parse_menu_t show_sync_menu[] = {
00097     { "counter", NULL, 0, show_sync_counter_menu, NULL },
00098     { NULL, NULL, 0, NULL, NULL }
00099 };
00100 
00104 static const parse_menu_t show_menu[] = {
00105     { "sync", NULL, 0, show_sync_menu, NULL },
00106     { NULL, NULL, 0, NULL, NULL }
00107 };
00108 
00112 const parse_menu_t master_menu[] = {
00113     { "show", NULL, 0, show_menu, NULL }, 
00114     { NULL, NULL, 0, NULL, NULL }
00115 };
00116 

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