psd_config.c File Reference

Relating to loading and storing the configuration data. More...

#include <sync/common.h>
#include <sync/psd_ipc.h>
#include <ddl/dax.h>
#include "psd_server.h"
#include "psd_config.h"

Go to the source code of this file.

Defines

#define EMPTY   -3
 empty config return code
#define DEFAULT_ROUTE_METRIC   5
 default route metric
#define DEFAULT_ROUTE_PREF   5
 default route preference

Functions

static void delete_policy (psd_policy_t *policy)
static void clear_config_policy (void)
static int config_read_route (ddl_handle_t *policy_op, psd_policy_t *policy)
static int config_read_filter (ddl_handle_t *policy_op, psd_policy_t *policy)
void init_config (void)
psd_policy_tfirst_policy (void)
psd_policy_tnext_policy (psd_policy_t *policy)
int psd_config_read (int check)

Variables

static patroot root_policy
 patricia tree root


Detailed Description

Relating to loading and storing the configuration data.

These functions and variables will parse, load, hold, and return the configuration data.

Definition in file psd_config.c.


Function Documentation

static void clear_config_policy ( void   )  [static]

Clear the configuration info completely from the patricia tree

Definition at line 87 of file psd_config.c.

References delete_policy(), and first_policy().

Referenced by psd_config_read().

static int config_read_filter ( ddl_handle_t *  policy_op,
psd_policy_t policy 
) [static]

Read filter configuration

Parameters:
[in] policy_op DDL object pointer.
[in] policy Pointer to policy.
Returns:
SUCCESS; EFAIL on error; EMPTY when no routes

Definition at line 220 of file psd_config.c.

References psd_policy_s::af, policy_filter_msg_s::af, EMPTY, psd_policy_s::filter, psd_policy_filter_s::filter_data, psd_policy_s::ifname, policy_filter_msg_s::ifname, policy_filter_msg_s::input_filter, MAX_FILTER_NAME_LEN, and policy_filter_msg_s::output_filter.

Referenced by psd_config_read().

static int config_read_route ( ddl_handle_t *  policy_op,
psd_policy_t policy 
) [static]

Read route configuration

Parameters:
[in] policy_op DDL object pointer.
[in] policy Pointer to policy.
Returns:
SUCCESS, or EFAIL on error; EMPTY when no routes

Definition at line 111 of file psd_config.c.

References psd_policy_s::af, policy_route_msg_s::af, DEFAULT_ROUTE_METRIC, DEFAULT_ROUTE_PREF, EMPTY, psd_policy_s::ifname, policy_route_msg_s::ifname, policy_route_msg_s::metrics, psd_policy_route_s::next, policy_route_msg_s::nh_addr, policy_route_msg_s::nh_type, policy_route_msg_s::preferences, psd_policy_s::route, policy_route_msg_s::route_addr, policy_route_msg_s::route_addr_prefix, and psd_policy_route_s::route_data.

Referenced by psd_config_read().

static void delete_policy ( psd_policy_t policy  )  [static]

Remove a policy from the configuration, used only internally when emptying the patricia tree (in clear_config)

Parameters:
[in] policy Policy to be deleted from the configuration data storage

Definition at line 60 of file psd_config.c.

References psd_policy_route_s::next, and root_policy.

Referenced by clear_config_policy().

psd_policy_t* first_policy ( void   ) 

Get the first policy from configuration.

Returns:
The first policy in configuration, or NULL if no policy is in configuration.

Definition at line 290 of file psd_config.c.

References root_policy.

Referenced by clear_config_policy(), and lookup_policy().

void init_config ( void   ) 

Init the data structure that will store configuration info, or in other words, the policies.

Definition at line 275 of file psd_config.c.

References MAX_POLICY_NAME_LEN, and root_policy.

Referenced by psd_init().

psd_policy_t* next_policy ( psd_policy_t policy  ) 

Get (iterator-style) the next policy from configuration.

Parameters:
[in] policy The previously returned policy from this function, or NULL for the first policy.
Returns:
The next policy in configuration, or NULL if data is the last one in configuration.

Definition at line 307 of file psd_config.c.

References psd_policy_s::node, and root_policy.

Referenced by lookup_policy().

int psd_config_read ( int  check  ) 

Read configuration from the database.

Parameters:
[in] check SDK_CONFIG_READ_CHECK(1) if this function was called to check configuration, or SDK_CONFIG_READ_LOAD(0) if it's called to load configuration.
Returns:
SUCCESS, or -1 on error.
Note:
Do not use ERRMSG during config check.

Definition at line 328 of file psd_config.c.

References psd_policy_s::af, clear_config_policy(), config_read_filter(), config_read_route(), EMPTY, psd_policy_s::filter, psd_policy_s::ifname, psd_policy_route_s::next, psd_policy_s::node, notify_all_clients(), psd_policy_s::policy_name, root_policy, and psd_policy_s::route.

Referenced by main().


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