Libraries in the SDK

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::

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:

Libraries in the Services SDK

The Services SDK libraries fall into two categories:

Libraries Specific to the 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.

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.

The 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.

Forwarding Database

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 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.

Policy Database

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.

For information on tracing and logging, see Logging and Tracing on the Multiservices PIC.

Libraries in Common with the RE SDK

The Services SDK uses the following libraries also used by the RE SDK.

Note:
Libraries in common with the RE SDK are not thread safe and must be used from a process context.

SDK Libraries in Architectural Context

The following figure shows the libraries in the RE SDK and Services SDK in the context of the overall Junos software architecture.

apis-context-g016949.gif

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