ped_kcom.c File Reference

Init kcom and register handler. More...

#include <sync/common.h>
#include <jnx/provider_info.h>
#include "ped_services.h"
#include "ped_kcom.h"
#include "ped_config.h"
#include "ped_conn.h"
#include "ped_policy_table.h"
#include "ped_service_route.h"
#include "ped_logging.h"

Go to the source code of this file.

Defines

#define KCOM_ID_PED   77
 ID of this app with KCOM.
#define MSP_IFD_NAME_PATTERN   "ms-"
 common part of MS PIC interface names
#define INT_NAME_STR_SIZE   64
 string size for interface names

Functions

static int iff_async_handler (kcom_iff_t *msg, void *user_info __unused)
static int iff_manage_handler (kcom_iff_t *msg, void *user_info __unused)
static int ifd_async_handler (kcom_ifdev_t *msg, void *user_info __unused)
int get_interface_total (void)
void update_all_interfaces (void)
int ped_kcom_init (void)

Variables

evContext ped_ctx
 Event context for ped.
static int if_count
 # of IFFs interfaces counted in callback
static int if_total = 0
 Total # of IFFs after junos_kcom_iff_get_all.


Detailed Description

Init kcom and register handler.

Initialize KCOM and register a handler for iff changes

Definition in file ped_kcom.c.


Function Documentation

int get_interface_total ( void   ) 

Get the number of all interfaces.

Definition at line 174 of file ped_kcom.c.

References if_total.

Referenced by handler_if_total().

static int ifd_async_handler ( kcom_ifdev_t *  msg,
void *user_info  __unused 
) [static]

Gets called for all ifds and calls update_interface with INTERFACE_REFRESH.

Parameters:
[in] msg The ifd we want to know about
[in] user_info User info that was registered to be passed to this callback
Returns:
0 upon successful completion, otherwise -1

Definition at line 147 of file ped_kcom.c.

References MSP_IFD_NAME_PATTERN, and mspic_offline().

Referenced by ped_kcom_init().

static int iff_async_handler ( kcom_iff_t *  msg,
void *user_info  __unused 
) [static]

The callback registered to handle changes in the iffs.

Parameters:
[in] msg The iff we want to know about
[in] user_info User info that was registered to be passed to this callback
Returns:
0 upon successful completion, otherwise -1

Definition at line 65 of file ped_kcom.c.

References INTERFACE_ADD, INTERFACE_DELETE, and update_interface().

Referenced by ped_kcom_init().

static int iff_manage_handler ( kcom_iff_t *  msg,
void *user_info  __unused 
) [static]

Gets called for all iffs and calls update_interface with INTERFACE_REFRESH.

Parameters:
[in] msg The iff we want to know about
[in] user_info User info that was registered to be passed to this callback
Returns:
0 upon successful completion, otherwise -1

Definition at line 118 of file ped_kcom.c.

References if_count, INTERFACE_REFRESH, and update_interface().

Referenced by update_all_interfaces().

int ped_kcom_init ( void   ) 

Init KCOM library and register handlers for asynchronous KCOM messages.

Returns:
KCOM_OK (0) on success, or -1 on error.

Definition at line 208 of file ped_kcom.c.

References ifd_async_handler(), iff_async_handler(), and ped_ctx.

Referenced by ped_init().

void update_all_interfaces ( void   ) 

Update policy information and apply it for all interfaces which match the configured conditions by calling update_interface for all IFFs

Definition at line 184 of file ped_kcom.c.

References if_count, if_total, and iff_manage_handler().

Referenced by psd_ipc_read().


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:27:06 2010 for SDK Your Net Corporation Policy Manager Example: Policy Enforcement Daemon 1.0 by Doxygen 1.5.1