dpm-ctrl_config.c File Reference

Relating to getting and setting the configuration data. More...

#include "dpm-ctrl_main.h"
#include <jnx/vrf_util_pub.h>
#include <jnx/rt_shared_pub.h>
#include <jnx/ipc_types.h>
#include <jnx/ipc_msp_pub.h>
#include "dpm-ctrl_dfw.h"
#include "dpm-ctrl_http.h"
#include "dpm-ctrl_config.h"

Go to the source code of this file.

Data Structures

struct  policer_s
struct  int_pol_s
struct  subscriber_s
struct  user_s

Defines

#define VRFINDEX_ERROR   -1
 Error code when not able to get VRF index.

Typedefs

typedef policer_s policer_t
typedef int_pol_s int_pol_t
typedef subscriber_s subscriber_t
typedef user_s user_t

Functions

status_t init_configuration (void)
void clear_configuration (void)
void reset_configuration (uint8_t filter_mode)
void configuration_complete (void)
void configure_policer (policer_info_t *policer)
void configure_managed_interface (int_info_t *interface)
void configure_subscriber (sub_info_t *subscriber)
boolean validate_credentials (char *username, char *password)
boolean user_logged_in (in_addr_t address)
status_t apply_policy (char *username, in_addr_t address)
void remove_policy (in_addr_t address)

Variables

msp_fdb_handle_t fdb_handle
 handle for FDB (forwarding DB)
static uint8_t use_classic_filters
 filter application mode (T/F value)
static int vrf_default
 VRF index of default routing instance.
static patroot sub_conf
 Pat. root for subscribers.
static patroot user_conf
 Pat. root for logged in subscribers.
static patroot pol_conf
 Pat. root for policers.
static patroot int_conf
 Pat. root for interface def. policies Patricia tree root for interface default policies indexed by interface name.
static patroot int_conf2
 Pat. root for interface def. policies Patricia tree root for interface default policies indexed by interface index.


Detailed Description

Relating to getting and setting the configuration data.

These functions will store and provide access to the configuration data which is essentailly coming from the mgmt component.

Definition in file dpm-ctrl_config.c.


Typedef Documentation

typedef struct int_pol_s int_pol_t

The structure we use to bundle the patricia-tree node with the data to store for each interface default policy

typedef struct policer_s policer_t

The structure we use to bundle the patricia-tree node with the data to store for each policer

typedef struct subscriber_s subscriber_t

The structure we use to bundle the patricia-tree node with the data to store for each subscriber

typedef struct user_s user_t

The structure we use to bundle the patricia-tree node with the data to store for each user (subscriber that is logged in)


Function Documentation

status_t apply_policy ( char *  username,
in_addr_t  address 
)

Apply the policy for this user, and add them to the logged in users

Parameters:
[in] username The subscriber's name
[in] address The user's IP address
Returns:
SUCCESS upon sucessfully applying the policy; EFAIL otherwise

Definition at line 454 of file dpm-ctrl_config.c.

References user_s::address, apply_subscriber_policer(), int_pol_s::ifl_name, INSIST_ERR, user_s::interface, LOG, sub_info_s::name, user_s::node, subscriber_s::policer, user_s::sub, and subscriber_s::subscriber.

Referenced by login().

void clear_configuration ( void   ) 

Clear the configuration data

Definition at line 184 of file dpm-ctrl_config.c.

References LOG, policer_s::node, int_pol_s::node, subscriber_s::node, user_s::node, and int_pol_s::node2.

Referenced by dpm_quit(), mgmt_client_connection(), and reset_configuration().

void configuration_complete ( void   ) 

All configuration should now be received

Definition at line 252 of file dpm-ctrl_config.c.

References apply_default_int_policy(), create_policer(), int_pol_s::ifl_name, int_pol_s::input_pol, policer_s::node, int_pol_s::output_pol, reset_all_filters(), and resume_http_server().

Referenced by mgmt_client_message().

void configure_managed_interface ( int_info_t interface  ) 

Configure a managed interface All policers should be configured first

Parameters:
[in] interface The interface configuration received from the mgmt component

Definition at line 317 of file dpm-ctrl_config.c.

References int_pol_s::ifl_name, int_pol_s::index, int_info_s::index, int_pol_s::input_pol, int_info_s::input_pol, INSIST_ERR, LOG, int_info_s::name, int_pol_s::node, int_pol_s::node2, int_pol_s::output_pol, int_info_s::output_pol, and int_info_s::subunit.

Referenced by mgmt_client_message().

void configure_policer ( policer_info_t policer  ) 

Configure a policer

Parameters:
[in] policer The policer configuration received from the mgmt component

Definition at line 286 of file dpm-ctrl_config.c.

References INSIST_ERR, LOG, and policer_s::node.

Referenced by mgmt_client_message().

void configure_subscriber ( sub_info_t subscriber  ) 

Configure a subscriber All policers and managed interfaces should be configured first

Parameters:
[in] subscriber The subscriber configuration received from the mgmt component

Definition at line 366 of file dpm-ctrl_config.c.

References INSIST_ERR, LOG, sub_info_s::name, subscriber_s::node, subscriber_s::policer, sub_info_s::policer, and subscriber_s::subscriber.

Referenced by mgmt_client_message().

status_t init_configuration ( void   ) 

Init the data structures that will store configuration info

Returns:
SUCCESS if successful; otherwise EFAIL with an error message.

Definition at line 158 of file dpm-ctrl_config.c.

References LOG, MAX_INT_NAME, MAX_POL_NAME, MAX_SUB_NAME, and VRFINDEX_ERROR.

Referenced by dpm_init().

void remove_policy ( in_addr_t  address  ) 

Remove the policy for this user, and remove them from the logged in users

Parameters:
[in] address The user's IP address

Definition at line 533 of file dpm-ctrl_config.c.

References int_pol_s::ifl_name, user_s::interface, LOG, sub_info_s::name, user_s::node, revoke_subscriber_policer(), user_s::sub, and subscriber_s::subscriber.

Referenced by logout().

void reset_configuration ( uint8_t  filter_mode  ) 

Reset the configuration

Definition at line 240 of file dpm-ctrl_config.c.

References clear_configuration(), and suspend_http_server().

Referenced by mgmt_client_message().

boolean user_logged_in ( in_addr_t  address  ) 

Check for a match with the IP address

Parameters:
[in] address The user's IP address
Returns:
TRUE if there is a user logged in with this IP, FALSE otherwise

Definition at line 436 of file dpm-ctrl_config.c.

Referenced by check_access(), and logout().

boolean validate_credentials ( char *  username,
char *  password 
)

Check for a match with the username-password pair

Parameters:
[in] username The subscriber's name
[in] password The subscriber's password
Returns:
TRUE if there is a match, FALSE otherwise

Definition at line 412 of file dpm-ctrl_config.c.

References sub_info_s::password, and subscriber_s::subscriber.

Referenced by login().


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:54 2010 for SDK Your Net Corporation Dynamic Policy Manager Example: dpm-ctrl 1.0 by Doxygen 1.5.1