equilibrium-mgmt_config.c File Reference

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

#include <sync/common.h>
#include <ddl/dax.h>
#include "equilibrium-mgmt_config.h"
#include "equilibrium-mgmt_conn.h"
#include "equilibrium-mgmt_logging.h"

Go to the source code of this file.

Data Structures

struct  eq_app_key_s

Defines

#define MAX_SVC_SETID   0xFFFF
 Max Service set id.
#define DDLNAME_SERVICE_SET_IDENT   "service-set-name"
 service-set name's attribute
#define DDLNAME_EXTENTION_SERVICE_IDENT   "service-name"
 extension-service name's attribute
#define DDLNAME_INTERFACE_SERVICE   "interface-service"
 interface-service object
#define DDLNAME_INTERFACE_SERVICE_SVC_INT   "service-interface"
 service-interface attribute

Typedefs

typedef eq_app_key_s eq_app_key_t

Functions

typedef TAILQ_HEAD (eq_app_key_s)
static eq_serviceset_tupdate_service_set (const char *ss_name, const char *svc_name, const char *svc_int_name)
static eq_app_tupdate_application (const char *name, in_addr_t address, uint16_t port, eq_smon_t *server_monitor, uint16_t session_timeout)
static void update_server (in_addr_t server_address)
static void delete_server (in_addr_t server_address)
static void delete_application (patroot *apps, eq_app_t **application, boolean notify)
static void delete_service_set (eq_serviceset_t **service_set, boolean notify)
static void delete_all_servers (void)
static void delete_all_applications (void)
static void delete_all_service_sets (void)
static int parse_server (dax_walk_data_t *dwd, ddl_handle_t *dop, int action, void *data)
static int check_applications (dax_walk_data_t *dwd __unused, ddl_handle_t *dop, int action __unused, void *data)
static int parse_application (dax_walk_data_t *dwd, ddl_handle_t *dop, int action, void *data)
static int parse_service_set (dax_walk_data_t *dwd, ddl_handle_t *dop, int action, void *data)
void init_config (void)
void clear_config (void)
void clear_ssrb_config (void)
int add_ssrb (junos_kcom_pub_ssrb_t *ssrb)
junos_kcom_pub_ssrb_t * get_ssrb_by_name (char *name)
junos_kcom_pub_ssrb_t * get_ssrb_by_id (uint16_t svc_set_id)
void delete_ssrb_by_name (char *name)
void delete_ssrb_by_id (uint16_t svc_set_id)
void set_server_status (uint16_t svc_set_id, char *app_name, in_addr_t server_addr, uint8_t status)
void set_app_sessions (uint16_t svc_set_id, char *app_name, uint32_t session_count)
eq_serviceset_tnext_service_set (eq_serviceset_t *data)
eq_app_tnext_application (eq_serviceset_t *ss, eq_app_t *data)
eq_serviceset_tfind_service_set (const char *name)
eq_app_tfind_application (const eq_serviceset_t *ss, const char *name)
int equilibrium_config_read (int check)

Variables

const char * equilibrium_service_prefix = "equilibrium-"
 eq_ssrb_t
static patroot services_conf
 Pat. root for services config.
static patroot ssrb_conf
 Pat. root for ssrb config (lookup by name).
static eq_serviceset_tcurrent_svc_set = NULL
 current service set while loading configuration
static eq_app_tcurrent_app = NULL
 current application while loading configuration


Detailed Description

Relating to loading and storing the configuration data.

These functions will parse and load the configuration data.

Definition in file equilibrium-mgmt_config.c.


Typedef Documentation

typedef struct eq_app_key_s eq_app_key_t

The structure we use to bundle the app address and port. We keep a list of these during the configuration check to ensure no duplicates within a single service set.


Function Documentation

int add_ssrb ( junos_kcom_pub_ssrb_t *  ssrb  ) 

Add an SSRB to the configuration, may not exist prior

Parameters:
[in] ssrb The new SSRB data
Returns:
SUCCESS when added, or EFAIL if it already exists, or upon add failure

Definition at line 1189 of file equilibrium-mgmt_config.c.

References eq_ssrb_t, get_ssrb_by_name(), LOG, MAX_SVC_SET_NAME, and ssrb_conf.

Referenced by process_initial_ssrb(), and ssrb_async_handler().

static int check_applications ( dax_walk_data_t *dwd  __unused,
ddl_handle_t *  dop,
int action  __unused,
void *  data 
) [static]

Check the uniqueness of the application's address and port given a list of existing applications' addresses and ports. If it is unique we add it to the list. This list is only maintained temporarily

Parameters:
[in] dwd Opaque dax data
[in] dop DAX Object Pointer for application object
[in] action The action on the given application object
[in] data User data passed to handler (list of existing application addresses and ports)
Returns:
DAX_WALK_OK upon success or DAX_WALK_ABORT upon failure

Definition at line 643 of file equilibrium-mgmt_config.c.

References eq_app_key_s::addr, and eq_app_key_s::port.

Referenced by parse_service_set().

void clear_config ( void   ) 

Clear the (non-SSRB) configuration info

Definition at line 1154 of file equilibrium-mgmt_config.c.

References clear_ssrb_config(), and delete_all_service_sets().

Referenced by equilibrium_init(), and equilibrium_shutdown().

void clear_ssrb_config ( void   ) 

Clear the SSRB configuration info

Definition at line 1166 of file equilibrium-mgmt_config.c.

References eq_ssrb_t, LOG, and ssrb_conf.

Referenced by clear_config(), and equilibrium_shutdown().

static void delete_all_applications ( void   )  [static]

Delete all applications from the current service set's configuration

Definition at line 463 of file equilibrium-mgmt_config.c.

References eq_serviceset_s::applications, current_svc_set, delete_application(), get_ssrb_by_name(), notify_delete_all_applications(), eq_serviceset_s::svc_set_id, and eq_serviceset_s::svc_set_name.

Referenced by parse_application().

static void delete_all_servers ( void   )  [static]

Delete all servers from the current application's configuration

Definition at line 440 of file equilibrium-mgmt_config.c.

References eq_app_s::application_name, current_app, current_svc_set, notify_delete_all_servers(), eq_app_s::servers, and eq_serviceset_s::svc_set_name.

Referenced by parse_server().

static void delete_all_service_sets ( void   )  [static]

Delete all service sets from the configuration

Definition at line 505 of file equilibrium-mgmt_config.c.

References delete_service_set(), notify_delete_all(), and services_conf.

Referenced by clear_config(), equilibrium_config_read(), and parse_service_set().

static void delete_application ( patroot *  apps,
eq_app_t **  application,
boolean  notify 
) [static]

Delete an application from the configuration

Parameters:
[in] apps The Pat tree root containing the application
[in] application Pointer to the application to delete
[in] notify Whether or not to notify data component, if not it should be done by caller

Definition at line 342 of file equilibrium-mgmt_config.c.

References eq_app_s::application_name, current_svc_set, eq_app_s::node, notify_application_delete(), eq_app_s::server_mon_params, eq_app_s::servers, and eq_serviceset_s::svc_set_name.

Referenced by delete_all_applications(), delete_service_set(), and parse_application().

static void delete_server ( in_addr_t  server_address  )  [static]

Delete a server from the set of servers for the current application

Parameters:
[in] server_address The address of the server to delete

Definition at line 301 of file equilibrium-mgmt_config.c.

References eq_app_s::application_name, current_app, current_svc_set, notify_server_delete(), eq_server_s::server_addr, eq_app_s::servers, and eq_serviceset_s::svc_set_name.

Referenced by parse_server().

static void delete_service_set ( eq_serviceset_t **  service_set,
boolean  notify 
) [static]

Delete a service set from the configuration

Parameters:
[in] service_set Pointer to the service set to delete
[in] notify Whether or not to notify data component, if not it should be done by caller

Definition at line 392 of file equilibrium-mgmt_config.c.

References eq_serviceset_s::applications, delete_application(), get_ssrb_by_name(), eq_serviceset_s::node, notify_serviceset_delete(), services_conf, eq_serviceset_s::svc_set_id, and eq_serviceset_s::svc_set_name.

Referenced by delete_all_service_sets(), and parse_service_set().

void delete_ssrb_by_id ( uint16_t  svc_set_id  ) 

Remove an SSRB from the configuration by id

Parameters:
[in] svc_set_id Service-set id

Definition at line 1317 of file equilibrium-mgmt_config.c.

References delete_ssrb_by_name(), and get_ssrb_by_id().

Referenced by ssrb_async_handler().

void delete_ssrb_by_name ( char *  name  ) 

Remove an SSRB from the configuration by name

Parameters:
[in] name Service-set name

Definition at line 1271 of file equilibrium-mgmt_config.c.

References eq_ssrb_t, LOG, services_conf, ssrb_conf, and eq_serviceset_s::svc_set_id.

Referenced by delete_ssrb_by_id().

int equilibrium_config_read ( int  check  ) 

Read daemon configuration from the database. (nothing to do except traceoptions)

Parameters:
[in] check 1 if this function being invoked because of a commit check
Returns:
SUCCESS (0) successfully loaded, EFAIL if not
Note:
Do not use ERRMSG/LOG during config check normally.

Definition at line 1515 of file equilibrium-mgmt_config.c.

References delete_all_service_sets(), parse_service_set(), and process_notifications().

Referenced by main().

eq_app_t* find_application ( const eq_serviceset_t ss,
const char *  name 
)

Get the application information in a service-set by name

Parameters:
[in] ss The service set to search
[in] name Application name
Returns:
The application if one exists with the matching name, o/w NULL

Definition at line 1497 of file equilibrium-mgmt_config.c.

References eq_serviceset_s::applications.

Referenced by equilibrium_show_status().

eq_serviceset_t* find_service_set ( const char *  name  ) 

Get the service-set information by name

Parameters:
[in] name service-set name
Returns:
The service set if one exists with the matching name, o/w NULL

Definition at line 1479 of file equilibrium-mgmt_config.c.

References services_conf.

Referenced by equilibrium_show_status().

junos_kcom_pub_ssrb_t* get_ssrb_by_id ( uint16_t  svc_set_id  ) 

Get an SSRB from the configuration by id

Parameters:
[in] svc_set_id Service-set id
Returns:
The ssrb data, or NULL if not found

Definition at line 1249 of file equilibrium-mgmt_config.c.

References eq_ssrb_t, and ssrb_conf.

Referenced by delete_ssrb_by_id(), set_app_sessions(), and set_server_status().

junos_kcom_pub_ssrb_t* get_ssrb_by_name ( char *  name  ) 

Get an SSRB from the configuration by name

Parameters:
[in] name Service-set name
Returns:
The ssrb data, or NULL if not found

Definition at line 1228 of file equilibrium-mgmt_config.c.

References eq_ssrb_t, and ssrb_conf.

Referenced by add_ssrb(), delete_all_applications(), delete_service_set(), and process_notifications_messages().

void init_config ( void   ) 

Init the data structure that will store configuration info, or in other words, the condition(s)

Definition at line 1142 of file equilibrium-mgmt_config.c.

References MAX_SVC_SET_NAME, services_conf, and ssrb_conf.

Referenced by equilibrium_init().

eq_app_t* next_application ( eq_serviceset_t ss,
eq_app_t data 
)

Get the next application in configuration given the previously returned data (from next_application).

Parameters:
[in] ss The service set of the application
[in] data previously returned data, should be NULL first time
Returns:
pointer to the first service set if one exists, o/w NULL

Definition at line 1463 of file equilibrium-mgmt_config.c.

References eq_serviceset_s::applications, and eq_app_s::node.

Referenced by equilibrium_show_status(), and TAILQ_HEAD().

eq_serviceset_t* next_service_set ( eq_serviceset_t data  ) 

Get the next service set in configuration given the previously returned data (from next_service_set).

Parameters:
[in] data previously returned data, should be NULL first time
Returns:
pointer to the first service set if one exists, o/w NULL

Definition at line 1443 of file equilibrium-mgmt_config.c.

References eq_serviceset_s::node, and services_conf.

Referenced by equilibrium_show_status(), and TAILQ_HEAD().

static int parse_application ( dax_walk_data_t *  dwd,
ddl_handle_t *  dop,
int  action,
void *  data 
) [static]

Handler for dax_walk_list to parse each configured application knob

Parameters:
[in] dwd Opaque dax data
[in] dop DAX Object Pointer for application object
[in] action The action on the given application object
[in] data User data passed to handler (check flag)
Returns:
DAX_WALK_OK upon success or DAX_WALK_ABORT upon failure

Definition at line 714 of file equilibrium-mgmt_config.c.

References eq_serviceset_s::applications, eq_smon_s::connection_interval, eq_smon_s::connection_timeout, current_app, current_svc_set, delete_all_applications(), delete_application(), eq_smon_s::down_retry_interval, MAX_APP_NAME, parse_server(), eq_smon_s::timeouts_allowed, and update_application().

Referenced by parse_service_set().

static int parse_server ( dax_walk_data_t *  dwd,
ddl_handle_t *  dop,
int  action,
void *  data 
) [static]

Handler for dax_walk_list to parse each configured server knob

Parameters:
[in] dwd Opaque dax data
[in] dop DAX Object Pointer for server object
[in] action The action on the given server object
[in] data User data passed to handler (check flag)
Returns:
DAX_WALK_OK upon success or DAX_WALK_ABORT upon failure

Definition at line 539 of file equilibrium-mgmt_config.c.

References current_app, delete_all_servers(), delete_server(), eq_app_s::servers, and update_server().

Referenced by parse_application().

static int parse_service_set ( dax_walk_data_t *  dwd,
ddl_handle_t *  dop,
int  action,
void *  data 
) [static]

Handler for dax_walk_list to parse each configured service-set knob

Parameters:
[in] dwd Opaque dax data
[in] dop DAX Object Pointer for service-set object
[in] action The action on the given service-set object
[in] data User data passed to handler (check flag)
Returns:
DAX_WALK_OK upon success or DAX_WALK_ABORT upon failure

Definition at line 908 of file equilibrium-mgmt_config.c.

References check_applications(), current_svc_set, DDLNAME_EXTENTION_SERVICE_IDENT, DDLNAME_INTERFACE_SERVICE, DDLNAME_INTERFACE_SERVICE_SVC_INT, DDLNAME_SERVICE_SET_IDENT, delete_all_service_sets(), delete_service_set(), equilibrium_service_prefix, MAX_SVC_INT_NAME, MAX_SVC_NAME, MAX_SVC_SET_NAME, parse_application(), services_conf, and update_service_set().

Referenced by equilibrium_config_read().

void set_app_sessions ( uint16_t  svc_set_id,
char *  app_name,
uint32_t  session_count 
)

Set the number of active sessions for an application

Parameters:
[in] svc_set_id Service-set id
[in] app_name Application name
[in] session_count Number of active sessions

Definition at line 1398 of file equilibrium-mgmt_config.c.

References eq_serviceset_s::applications, get_ssrb_by_id(), services_conf, and eq_app_s::session_count.

Referenced by receive_message().

void set_server_status ( uint16_t  svc_set_id,
char *  app_name,
in_addr_t  server_addr,
uint8_t  status 
)

Set server status

Parameters:
[in] svc_set_id Service-set id
[in] app_name Application name
[in] server_addr Server in the application
[in] status The updated status, according to the servers monitor

Definition at line 1339 of file equilibrium-mgmt_config.c.

References eq_serviceset_s::applications, get_ssrb_by_id(), eq_server_s::server_addr, eq_app_s::servers, services_conf, and eq_server_s::status.

Referenced by receive_message().

typedef TAILQ_HEAD ( eq_app_key_s   ) 

The structure we use to bundle the patricia-tree node with the data to store for an SSRB

< Tree node in ssrb_conf (comes first)

< SSRB info

Definition at line 61 of file equilibrium-mgmt_config.c.

static eq_app_t* update_application ( const char *  name,
in_addr_t  address,
uint16_t  port,
eq_smon_t server_monitor,
uint16_t  session_timeout 
) [static]

Update or add an application for the current service set

Parameters:
[in] name The application name
[in] address The application facade address
[in] port The application port
[in] server_monitor NULL for no monitor or the server monitor parameters
[in] session_timeout The session timeout for the application
Returns:
The added application

Definition at line 176 of file equilibrium-mgmt_config.c.

References eq_app_s::application_addr, eq_app_s::application_name, eq_app_s::application_port, eq_serviceset_s::applications, eq_smon_s::connection_interval, eq_smon_s::connection_timeout, current_svc_set, eq_smon_s::down_retry_interval, MAX_APP_NAME, eq_app_s::node, notify_application_update(), eq_app_s::server_mon_params, eq_app_s::session_timeout, eq_serviceset_s::svc_set_name, and eq_smon_s::timeouts_allowed.

Referenced by parse_application().

static void update_server ( in_addr_t  server_address  )  [static]

Add a server to the set for the current application

Parameters:
[in] server_address The address of the server to add

Definition at line 268 of file equilibrium-mgmt_config.c.

References eq_app_s::application_name, current_app, current_svc_set, notify_server_update(), eq_server_s::server_addr, eq_app_s::servers, and eq_serviceset_s::svc_set_name.

Referenced by parse_server().

static eq_serviceset_t* update_service_set ( const char *  ss_name,
const char *  svc_name,
const char *  svc_int_name 
) [static]

Update a service set. If it doesn't exist, then create it, and add it to the config tree

Parameters:
[in] ss_name service-set name
[in] svc_name service name
[in] svc_int_name service interface name
Returns:
The service set

Definition at line 120 of file equilibrium-mgmt_config.c.

References eq_serviceset_s::ext_svc_name, MAX_SVC_INT_NAME, MAX_SVC_NAME, MAX_SVC_SET_NAME, eq_serviceset_s::node, services_conf, eq_serviceset_s::svc_int_name, eq_serviceset_s::svc_set_id, and eq_serviceset_s::svc_set_name.

Referenced by parse_service_set().


Variable Documentation

const char* equilibrium_service_prefix = "equilibrium-"

Mandatory prefix for any service name belonging to equilibrium

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

Referenced by parse_service_set().


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:57 2010 for SDK Your Net Corporation Equilibrium Load Balancer Example: equilibrium-mgmt 1.0 by Doxygen 1.5.1