This page provides some details about the libraries in the SDK.
For a more detailed description of the SDK interfaces, see the library reference documentation.
Libraries are specified in header files that contain type definitions, constant definitions, macros, inline functions, and declarations of functions that are defined in libraries. In addition, an API can take the form of a protocol.
The Junos SDK relies on some standard UNIX libraries. It also adds many libraries specific to the Junos Software. In general, the standard UNIX libraries are used for basic functions common to most UNIX applications, such as::
Interprocess communication (sockets, pipes, mapped memory, etc.)
Character string manipulation
Multithreading is fully supported. However, not all functions in all libraries are thread safe. See the SDK Library Reference for information about individual functions.
The libraries specific to the Junos Software are used for functionality that works in a unique way in the Junos system, such as daemon initialization, socket communication and state, system configuration and logging, and adding and deleting routes.
The libraries can be categorized as follows:
The Services SDK libraries fall into two categories:
UNIX basic libraries: SDK applications must have access to standard UNIX system calls and library routines ( libc, libm, system headers, and so forth). Additional libraries that Junos daemons use also fall into this category and are included (for example, libisc2).
UNIX advanced library: The UNIX Advanced Library consists of less commonly used UNIX functions, that most programs that run in a UNIX-like environment could need. These libraries provide much of the richer functionality that differentiates programs.
A subset of the UNIX Advanced API is currently exposed in the SDK, and more libraries may be included based on future requirements. Libraries currently available are libfetch, libmd, and libutil.
Junos application libraries: These are libraries developed by Juniper that are typically used by Junos applications. Examples of Junos application libraries included in the SDK are:
Daemon initialization function for the RE SDK: Initializes and integrates a daemon into the Junos environment.
Configuration and command library for the RE SDK: SDK applications can define their own configuration and have it merged with the Junos configuration schema at runtime. A configuration prefix is provided for each partner to disambiguate symbol clashes between Junos and SDK attributes in configuration. Similarly, a partner application can define its own operational commands, which will be accessible from the Junos CLI via XML. (See Creating a User Interface with DDL and ODL for additional information.)
The libddl-access libraries let applications walk the configuration database to read configured values. For example, you can use this API to check whether the configuration at or below a certain point in the configuration tree has changed. (For more information, see Using DAX to Read Configurations.)
Tracing and error logging: The Junos SDK provides a syslog facility so that partner applications can clearly identify and isolate their trace, log, and error messages. (For more information, see Using Log and Trace Files.)
SNMP API: This interface enables any SDK application to become an SNMP subagent, connect to the master agent, register MIB objects, and process requests for object values. The SDK supports Net-SNMP version 5.3.1.
You can use the Net-SNMP libraries (as documented at
http://www.net-snmp.org/) to create a subagent and set traps. For creating a subagent, the following methods are officially supported:
getnext() for a given OID
You can also set SNMP traps using additional functions.
For more information on using SNMP and setting SNMP traps, see Using SNMP.
Kernel communication: The Junos Software uses a proprietary method of exchanging information between subsystems within the Routing Engine. Communication is based on a publish-and-subscribe model. Software agents subscribe to the messages they need to receive, and messages are published to all subscribers. The Junos SDK exposes this functionality as the KCOM API. Partner applications use it to enable the following:
For more information on the kernel communication functionality, see Working with the Junos Kernel.)
Synchronous communication with the kernel
Asynchronous notification of subscribed messages
Publishing application-specific opaque state elements to all interested applications, whether they are Routing Engine applications or data plane applications
Guaranteed delivery and proper ordering of messages
Junos specialized libraries: For example, the SDK includes libssd, an API that interacts with the SDK Service Daemon to add and delete routes.
libprovider: Lets applications retrieve the provider ID, prefix, origin ID, package ID, or program ID. You can use the provider ID to verify whether an application is an external partner application.
- Libraries specific to Services SDK
The libmp-sdk library contains functions that are specific to Services SDK. This library contains functions for working with data packets, initializing the application on the Multiservices PIC, raw packet handling, using FIFO queues, and socket affinity (the ability to run packet loops by pinning a thread or process to a CPU). libmp-sdk also includes global timestamp support and clock cycle support to estimate CPU usage for packet processing threads, spinlocks, and atomic operations.
- Libraries that are also in the RE SDK, either completely or in part. Routing Engine-based libraries are static (not shared.)
The libmsvcs-pmon library supports heartbeat health monitoring, monitoring of another peer process, and service name advertisement and resolution.
The Services SDK also supports the libpthreads libraries for creating and manipulating threads. For details, see Flow, Thread, and Session Affinities.
lw_getsystimes() function is an extension provided in libc to efficiently obtain the system time.
The libmsp-svcs library contains libraries to access the Junos forwarding database (FDB) for monitoring purposes, for using the Junos policy database, and for per-CPU buffered tracing and logging.
The forwarding database contains information related to route entries, associated outgoing interfaces, autonomous system information, SNMP identifier information for interfaces, and MPLS path information. Forwarding database information can be used by monitoring applications to log additional information about received packets, such as the outgoing interface and gateway. The functions for accessing the forwarding database are in the
sandbox/src/junos/lib/libmp-sdk in your backing sandbox and are declared in the header file
msp_fdb_api.h. For details about them, see the Library Reference documentation.
You enable monitoring in your system configuration; for more information, see Sampling Traffic in SDK Applications in the CLI Commands section of this documentation. Applications then use the functions in
The policy database can ultimately be used as a configuration guide to act upon traffic. Plugins initialize a policy database using the policy database API. mspmand must see that all services in a service set have policy databases that are initialized and ready before traffic flow begins. The policy database is initialized from a plugin's control component with data received from the management component, using the reliable configuration download functionality and the libconn communications library. The plugin control component updates the policy database as the management component sends configuration updates. The database can handle a lazy delete scheme that does not impact existing sessions.
sandbox/src/junos/lib/libmsp-svcs/h/jnx/msp_fdb_api.h to query for information about the received packets, such as the outgoing interface and gateway. A monitoring application can generate flow records in various formats, such as cflow, and the flow records can be collected and analyzed for numerous purposes, such as accounting, forensic, IDs, and so forth.
For information on tracing and logging, see Logging and Tracing on the Multiservices PIC.
The Services SDK uses the following libraries also used by the RE SDK.
The following figure shows the libraries in the RE SDK and Services SDK in the context of the overall Junos software architecture.
- Libraries in common with the RE SDK are not thread safe and must be used from a process context.
SDK Libraries in the Junos Architecture
© 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