equilibrium-data_config.c File Reference

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

#include "equilibrium-data_main.h"
#include "equilibrium-data_config.h"
#include "equilibrium-data_monitor.h"

Go to the source code of this file.

Data Structures

struct  eq_server_s
struct  eq_serviceset_s

Typedefs

typedef eq_server_s eq_server_t
typedef eq_serviceset_s eq_serviceset_t

Functions

typedef TAILQ_HEAD (server_list_s, eq_server_s)
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)
time_t get_current_time (void)
void reset_configuration (void)
void delete_service_set (uint16_t svc_set_id)
void delete_application (uint16_t svc_set_id, char *app_name)
void delete_all_servers (uint16_t svc_set_id, char *app_name)
void delete_server (uint16_t svc_set_id, char *app_name, in_addr_t server_addr)
void update_application (uint16_t svc_set_id, char *app_name, in_addr_t app_addr, uint16_t app_port, uint16_t session_timeout, uint16_t connection_interval, uint16_t connection_timeout, uint8_t timeouts_allowed, uint16_t down_retry_interval)
void add_server (uint16_t svc_set_id, char *app_name, in_addr_t server_addr)
char * get_app_name (uint16_t svc_set_id, in_addr_t addr, uint16_t port)
uint16_t get_app_session_timeout (uint16_t svc_set_id, in_addr_t addr, uint16_t port)

Variables

 eq_app_t
static patroot services_conf
 patricia tree root
static atomic_uint_t current_time


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 equilibrium-data_config.c.


Typedef Documentation

typedef struct eq_server_s eq_server_t

An item in a server set (tailq)

typedef struct eq_serviceset_s eq_serviceset_t

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


Function Documentation

void add_server ( uint16_t  svc_set_id,
char *  app_name,
in_addr_t  server_addr 
)

Add a server to an application in the configuration

Parameters:
[in] svc_set_id The service-set id of the service set associated with the application
[in] app_name The application name of the application associated with the server
[in] server_addr The server's address

Definition at line 602 of file equilibrium-data_config.c.

References eq_serviceset_s::applications, eq_app_t, INSIST_ERR, LOG, monitor_add_server(), eq_server_s::server_addr, and services_conf.

Referenced by mgmt_client_message().

void clear_config ( void   ) 

Clear the configuration data

Definition at line 161 of file equilibrium-data_config.c.

References reset_configuration().

Referenced by equilibrium_quit(), and mgmt_client_connection().

void delete_all_servers ( uint16_t  svc_set_id,
char *  app_name 
)

Delete all server associated with an application from the configuration

Parameters:
[in] svc_set_id The service-set id of the service set associated with the application
[in] app_name The application name

Definition at line 325 of file equilibrium-data_config.c.

References eq_serviceset_s::applications, eq_app_t, LOG, monitor_remove_all_servers_in_app(), and services_conf.

Referenced by mgmt_client_message().

void delete_application ( uint16_t  svc_set_id,
char *  app_name 
)

Delete an application from the configuration

Parameters:
[in] svc_set_id The service-set id of the service set associated with the application
[in] app_name The application name

Definition at line 266 of file equilibrium-data_config.c.

References eq_serviceset_s::applications, eq_app_t, LOG, monitor_remove_all_servers_in_app(), and services_conf.

Referenced by mgmt_client_message().

void delete_server ( uint16_t  svc_set_id,
char *  app_name,
in_addr_t  server_addr 
)

Delete a server associated with an application from the configuration

Parameters:
[in] svc_set_id The service-set id of the service set associated with the application
[in] app_name The application name of the application associated with the server
[in] server_addr The server address of the server to delete

Definition at line 378 of file equilibrium-data_config.c.

References eq_serviceset_s::applications, eq_app_t, LOG, monitor_remove_server(), eq_server_s::server_addr, and services_conf.

Referenced by mgmt_client_message().

void delete_service_set ( uint16_t  svc_set_id  ) 

Delete the configuration for a service set

Parameters:
[in] svc_set_id The service-set id of the service set to delete

Definition at line 201 of file equilibrium-data_config.c.

References eq_serviceset_s::applications, eq_app_t, LOG, monitor_remove_all_servers_in_service_set(), eq_serviceset_s::node, and services_conf.

Referenced by mgmt_client_message(), and reset_configuration().

char* get_app_name ( uint16_t  svc_set_id,
in_addr_t  addr,
uint16_t  port 
)

Search for the application with the given parameters, and if it exists return its name

Parameters:
[in] svc_set_id The service-set id of the service set associated with the application
[in] addr The application facade address
[in] port The application port
Returns:
the session timeout or 0 if no application meeting the parameters is found

Definition at line 670 of file equilibrium-data_config.c.

References eq_serviceset_s::applications, eq_app_t, and services_conf.

Referenced by TAILQ_HEAD().

uint16_t get_app_session_timeout ( uint16_t  svc_set_id,
in_addr_t  addr,
uint16_t  port 
)

Search for the application with the given parameters, and if it exists return its session timeout. Always only called by main thread.

Parameters:
[in] svc_set_id The service-set id of the service set associated with the application
[in] addr The application facade address
[in] port The application port
Returns:
the session timeout or 0 if no application meeting the parameters is found

Definition at line 717 of file equilibrium-data_config.c.

References eq_serviceset_s::applications, eq_app_t, and services_conf.

Referenced by aging_cleanup().

time_t get_current_time ( void   ) 

Get the currently cached time

Returns:
Current time

Definition at line 174 of file equilibrium-data_config.c.

References current_time.

Referenced by aging_cleanup(), process_fragment(), and process_packet().

status_t init_config ( evContext  ctx  ) 

Init the data structures that will store configuration info

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

Definition at line 138 of file equilibrium-data_config.c.

References current_time, LOG, services_conf, and update_time().

Referenced by equilibrium_init().

void reset_configuration ( void   ) 

Reset all of the configuration

Definition at line 184 of file equilibrium-data_config.c.

References delete_service_set(), services_conf, and eq_serviceset_s::svc_set_id.

Referenced by clear_config(), and mgmt_client_message().

typedef TAILQ_HEAD ( server_list_s  ,
eq_server_s   
)

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

< Tree node in applications (comes first)

< application name

< application IP address (network byte-order)

< application port (network byte-order)

< session timeout

< server monitoring parameters

< server list

< last reported number of active sessions

Definition at line 45 of file equilibrium-data_config.c.

References MAX_APP_NAME.

Referenced by monitor_remove_all_servers_in_service_set().

void update_application ( uint16_t  svc_set_id,
char *  app_name,
in_addr_t  app_addr,
uint16_t  app_port,
uint16_t  session_timeout,
uint16_t  connection_interval,
uint16_t  connection_timeout,
uint8_t  timeouts_allowed,
uint16_t  down_retry_interval 
)

Update or add an application to the configuration

Parameters:
[in] svc_set_id The service-set id of the service set associated with the application
[in] app_name The application name
[in] app_addr The application facade's address (unique to the application)
[in] app_port The application port
[in] session_timeout The session timeout of sessions falling into this application
[in] connection_interval The connection interval of the server monitoring parameters, or zero for no monitoring
[in] connection_timeout The connection timeout afterwhich the connection attempt is counted as failed if not already complete
[in] timeouts_allowed The number of connection timeouts that we can observe before we mark a server belonging to this application as down. (The number of retries)
[in] down_retry_interval The time to wait before retrying a probe (connection attempt) once a server is marked down.

Definition at line 462 of file equilibrium-data_config.c.

References eq_serviceset_s::applications, change_monitoring_config(), eq_smon_s::connection_interval, eq_smon_s::connection_timeout, eq_smon_s::down_retry_interval, eq_app_t, INSIST_ERR, LOG, MAX_APP_NAME, monitor_add_server(), monitor_remove_all_servers_in_app(), eq_serviceset_s::node, eq_server_s::server_addr, services_conf, eq_serviceset_s::svc_set_id, and eq_smon_s::timeouts_allowed.

Referenced by mgmt_client_message().

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

Update cached time

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 116 of file equilibrium-data_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 80 of file equilibrium-data_config.c.

Referenced by aging_cleanup(), get_current_time(), init_config(), 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:26:56 2010 for SDK Your Net Corporation Equilibrium Load Balancer Example: equilibrium-data 1.0 by Doxygen 1.5.1