pfd_config.c File Reference

Relating to getting and setting the configuration data coming from the CPD. More...

#include <string.h>
#include <pthread.h>
#include <jnx/atomic.h>
#include "pfd_config.h"
#include "pfd_logging.h"

Go to the source code of this file.

Functions

static void update_time (evContext ctx __unused, void *uap __unused, struct timespec due __unused, struct timespec inter __unused)
status_t init_config (evContext ctx)
void clear_config (void)
void add_auth_user_addr (in_addr_t addr)
void delete_auth_user_addr (in_addr_t addr)
boolean is_auth_user (in_addr_t addr)
in_addr_t get_pfd_address (void)
void set_pfd_address (in_addr_t addr)
in_addr_t get_cpd_address (void)
void set_cpd_address (in_addr_t addr)
time_t get_current_time (void)

Variables

static uint32_t first_byte [256]
 first-byte counters for pre-filtering
static uint32_t second_byte [256]
 second-byte counters for pre-filtering
static uint32_t third_byte [256]
 third-byte counters for pre-filtering
static uint32_t fourth_byte [256]
 fourth-byte counters for pre-filtering
static in_addr_t pfd_address
 PFD's address in network-byte order.
static in_addr_t cpd_address
 CPD's address in network-byte order.
static patroot root
 patricia tree root
static pthread_rwlock_t config_lock
 tree lock
static atomic_uint_t current_time


Detailed Description

Relating to getting and setting the configuration data coming from the CPD.

These functions and variables will store and provide access to the configuration data which is the set of authorized users.

Definition in file pfd_config.c.


Function Documentation

void add_auth_user_addr ( in_addr_t  addr  ) 

Add an authorized user from the configured set

Parameters:
[in] addr The user's IP address in network byte order

Definition at line 184 of file pfd_config.c.

References pfd_auth_user_t::address, config_lock, first_byte, fourth_byte, LOG, pfd_auth_user_t::node, root, second_byte, and third_byte.

Referenced by cpd_client_message().

void clear_config ( void   ) 

Clear the configuration data

Definition at line 148 of file pfd_config.c.

References config_lock, first_byte, fourth_byte, LOG, root, second_byte, and third_byte.

Referenced by cpd_client_connection(), pfd_quit(), and pfd_shutdown().

void delete_auth_user_addr ( in_addr_t  addr  ) 

Delete an authorized user from the configured set

Parameters:
[in] addr The user's IP address in network byte order

Definition at line 221 of file pfd_config.c.

References config_lock, first_byte, fourth_byte, LOG, root, second_byte, and third_byte.

Referenced by cpd_client_message().

in_addr_t get_cpd_address ( void   ) 

Get the CPD address

Returns:
The CPD address in network-byte order

Definition at line 322 of file pfd_config.c.

References cpd_address.

Referenced by cpd_client_connection().

time_t get_current_time ( void   ) 

Get the currently cached time

Returns:
Current time

Definition at line 348 of file pfd_config.c.

References current_time.

Referenced by nat_packet(), and reverse_nat_packet().

in_addr_t get_pfd_address ( void   ) 

Get the PFD address

Returns:
The PFD address in network-byte order

Definition at line 296 of file pfd_config.c.

References pfd_address.

Referenced by cpd_client_connection().

status_t init_config ( evContext  ctx  ) 

Init the data structure that will store configuration info, or in other words, the set of authorized users

Parameters:
[in] ctx event context
Returns:
SUCCESS if successful; otherwise EFAIL with an error message.

Definition at line 115 of file pfd_config.c.

References config_lock, cpd_address, current_time, first_byte, fourth_byte, LOG, pfd_address, root, second_byte, third_byte, and update_time().

Referenced by pfd_init().

boolean is_auth_user ( in_addr_t  addr  ) 

Is a user authorized

Parameters:
[in] addr The user's IP address in network byte order
Returns:
TRUE if authorized or FALSE otherwise

Definition at line 269 of file pfd_config.c.

References config_lock, first_byte, fourth_byte, root, second_byte, and third_byte.

Referenced by pfd_process_packet().

void set_cpd_address ( in_addr_t  addr  ) 

Set the CPD address

Parameters:
[in] addr The new CPD address in network-byte order

Definition at line 335 of file pfd_config.c.

References cpd_address.

Referenced by ped_client_message().

void set_pfd_address ( in_addr_t  addr  ) 

Set the PFD address

Parameters:
[in] addr The new PFD address in network-byte order

Definition at line 309 of file pfd_config.c.

References pfd_address.

Referenced by ped_client_message().

static void update_time ( evContext ctx  __unused,
void *uap  __unused,
struct timespec due  __unused,
struct timespec inter  __unused 
) [static]

Setup the connection to the CPD

Parameters:
[in] ctx The event context for this application
[in] uap The user data for this callback
[in] due The absolute time when the event is due (now)
[in] inter The period; when this will next be called

Definition at line 93 of file pfd_config.c.

References current_time.

Referenced by init_config().


Variable Documentation

atomic_uint_t current_time [static]

The current cached time. Cache it to prevent many system time() calls by the data threads.

Definition at line 66 of file pfd_config.c.

Referenced by get_current_time(), init_config(), nat_packet(), reverse_nat_packet(), and update_time().


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: Packet Filtering Daemon (pfd) 1.0 by Doxygen 1.5.1