Application Flow

The application workflow is as follows:

First, a user enters the following at the CLI command prompt:

> configure
# set sync helloworld  message "Hello SDK World!"

To initialize itself on the Routing Engine, the application next begins a series of steps in main(), culminating in a call to the junos_app_init() function:

The code for this is as follows:

main (int argc, char ** argv)
    int ret = 0;
    junos_sdk_app_ctx_t ctx;

    /* Create an application context */
    ctx = junos_create_app_ctx(argc, argv, DNAME_HELLOWORLDD,
                               master_menu, PACKAGE_NAME, SEQUENCE_NUMBER);
    if (ctx == NULL) {
        return -1;

    /* Set config read call back */
    if ((ret = junos_set_app_cb_config_read(ctx, helloworld_config_read))) {
        goto cleanup;

    /* Set init call back */
    if ((ret = junos_set_app_cb_init(ctx, helloworld_init))) {
        goto cleanup;

    /* Calling junos_app_init */
    ret = junos_app_init(ctx);

The system next executes the following operations:

  1. Calls the helloworld_init() function to perform additional initialization needed by the daemon. (see Main Function: Performing Setup and Initializing the Daemon)

  2. Opens the configuration database and calls the helloworld_config_read() function to read and apply the daemon's configuration. (see Creating the Tree and Adding Messages)

  3. Converts the process into a daemon and enters the ISC event loop to wait for events or user commands.

The application sets up the menu of commands in the helloworld_ui.c file, which also includes the code to display the message; this commands menu is the array passed to junos_daemon_init() in the master_menu parameter. (See Creating the Commands Menu Array).

Loading and Reading the Message

To load the message into the configuration database, the application:

For more information, see Creating the Tree and Adding Messages.

Displaying a Message

Assume that the user now enters the following command:

>show sync helloworld message

The daemon fetches the message (see Reading the Configuration ) and then uses ODL to format and display the message (see Coding, Fetching, and Displaying the Output.)

Contents of this Topic

This topic continues with the following sections:

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:47 2010 for Juniper Networks Partner Solution Development Platform JUNOS SDK 10.2R1 by Doxygen 1.4.5