equilibrium-mgmt_conn.c File Reference

Relating to managing the connections. More...

#include <sync/common.h>
#include <jnx/pconn.h>
#include <sync/equilibrium_ipc.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  notification_msg_s

Defines

#define EQUILIBRIUM_MGMT_SERVER_MAX_CONN   1
 max # cnxs (for data)
#define RETRY_INTERVAL   5
 retry processing notification messages

Typedefs

typedef notification_msg_s notification_msg_t

Functions

static TAILQ_HEAD (notification_buffer_s, notification_msg_s)
static status_t receive_message (pconn_session_t *session, ipc_msg_t *msg, void *cookie __unused)
static void process_notifications_messages (evContext ctx __unused, void *uap __unused, struct timespec due __unused, struct timespec inter __unused)
status_t init_server (evContext ctx)
void close_connections (void)
void mspic_offline (const char *name)
void process_notifications (void)
void notify_application_update (const char *svc_set_name, const char *app_name, in_addr_t address, uint16_t port, uint16_t session_timeout, uint16_t connection_interval, uint16_t connection_timeout, uint8_t timeouts_allowed, uint16_t down_retry_interval)
void notify_server_update (const char *svc_set_name, const char *app_name, in_addr_t address)
void notify_server_delete (const char *svc_set_name, const char *app_name, in_addr_t address)
void notify_application_delete (const char *svc_set_name, const char *app_name)
void notify_serviceset_delete (const char *svc_set_name, uint16_t svc_set_id)
void notify_delete_all_servers (const char *svc_set_name, const char *app_name)
void notify_delete_all_applications (const char *svc_set_name, uint16_t svc_set_id)
void notify_delete_all (void)

Variables

static evContext eq_ctx
 Event context for equilibrium.
static pconn_server_t * mgmt_server
 the server connection info
static pconn_session_t * data_session
 the session to the data component
static pconn_peer_info_t * data_info
 info about the connection
static evTimerID timer_id
 timer for process_notifications retry


Detailed Description

Relating to managing the connections.

These functions and types will manage the connections.

Definition in file equilibrium-mgmt_conn.c.


Typedef Documentation

typedef struct notification_msg_s notification_msg_t

A notification message to store in the queue of message to go out to the data component when SSRB info is ready and when the data component is connected


Function Documentation

void close_connections ( void   ) 

Close existing connections and shutdown server

Definition at line 490 of file equilibrium-mgmt_conn.c.

References notification_msg_s::action, data_info, data_session, EQUILIBRIUM_PORT_NUM, notification_msg_s::message, mgmt_server, MSG_DELETE_ALL, and notification_msg_s::svc_set_name.

Referenced by equilibrium_init(), and equilibrium_shutdown().

status_t init_server ( evContext  ctx  ) 

Initialize the server socket connection

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

Definition at line 452 of file equilibrium-mgmt_conn.c.

References data_info, data_session, eq_ctx, EQUILIBRIUM_MGMT_SERVER_MAX_CONN, EQUILIBRIUM_PORT_NUM, LOG, mgmt_server, receive_message(), and timer_id.

Referenced by equilibrium_init().

void mspic_offline ( const char *  name  ) 

Notification about an MS-PIC interface going down

Parameters:
[in] name name of interface that has gone down

Definition at line 534 of file equilibrium-mgmt_conn.c.

References data_info, and data_session.

Referenced by ifd_down_async_handler().

void notify_application_delete ( const char *  svc_set_name,
const char *  app_name 
)

Enqueue a message to go to the data component about an application deletion

Parameters:
[in] svc_set_name Service set name
[in] app_name Application name

Definition at line 746 of file equilibrium-mgmt_conn.c.

References notification_msg_s::action, del_app_info_s::app_name, server_info_s::app_name, update_app_info_s::app_name, del_app_info_s::app_name_len, notification_msg_s::message, notification_msg_s::message_len, MSG_CONF_APPLICATION, MSG_CONF_SERVER, MSG_DELETE_ALL_SERVERS, MSG_DELETE_APP, MSG_DELETE_SERVER, and notification_msg_s::svc_set_name.

Referenced by delete_application().

void notify_application_update ( const char *  svc_set_name,
const char *  app_name,
in_addr_t  address,
uint16_t  port,
uint16_t  session_timeout,
uint16_t  connection_interval,
uint16_t  connection_timeout,
uint8_t  timeouts_allowed,
uint16_t  down_retry_interval 
)

Enqueue a message to go to the data component about an application update

Parameters:
[in] svc_set_name Service set name
[in] app_name Application name
[in] address Application address
[in] port Application port
[in] session_timeout Application session timeout
[in] connection_interval Application server monitoring connection interval
[in] connection_timeout Application server monitoring connection timeout
[in] timeouts_allowed Application server monitoring connection timeouts allowed
[in] down_retry_interval Application server monitoring, down servers' retry connection interval

Definition at line 604 of file equilibrium-mgmt_conn.c.

References notification_msg_s::action, update_app_info_s::app_addr, update_app_info_s::app_name, update_app_info_s::app_name_len, update_app_info_s::app_port, update_app_info_s::connection_interval, update_app_info_s::connection_timeout, update_app_info_s::down_retry_interval, notification_msg_s::message, notification_msg_s::message_len, MSG_CONF_APPLICATION, update_app_info_s::session_timeout, notification_msg_s::svc_set_name, and update_app_info_s::timeouts_allowed.

Referenced by TAILQ_HEAD(), and update_application().

void notify_delete_all ( void   ) 

Enqueue a message to go to the data component about a deletion of all config

Definition at line 965 of file equilibrium-mgmt_conn.c.

References notification_msg_s::action, notification_msg_s::message, MSG_DELETE_ALL, and notification_msg_s::svc_set_name.

Referenced by delete_all_service_sets(), and TAILQ_HEAD().

void notify_delete_all_applications ( const char *  svc_set_name,
uint16_t  svc_set_id 
)

Enqueue a message to go to the data component about a deletion of all apps

Parameters:
[in] svc_set_name Service set name
[in] svc_set_id Service set ID (We need it now for deletions since it won't be available later)

Definition at line 937 of file equilibrium-mgmt_conn.c.

References notification_msg_s::action, notification_msg_s::message, notification_msg_s::message_len, MSG_DELETE_SS, del_svcset_info_s::svc_set_id, and notification_msg_s::svc_set_name.

Referenced by delete_all_applications().

void notify_delete_all_servers ( const char *  svc_set_name,
const char *  app_name 
)

Enqueue a message to go to the data component about a deletion of all servers

Parameters:
[in] svc_set_name Service set name
[in] app_name Application name

Definition at line 897 of file equilibrium-mgmt_conn.c.

References notification_msg_s::action, del_app_info_s::app_name, del_app_info_s::app_name_len, notification_msg_s::message, notification_msg_s::message_len, MSG_DELETE_ALL_SERVERS, and notification_msg_s::svc_set_name.

Referenced by delete_all_servers().

void notify_server_delete ( const char *  svc_set_name,
const char *  app_name,
in_addr_t  address 
)

Enqueue a message to go to the data component about a server deletion

Parameters:
[in] svc_set_name Service set name
[in] app_name Application name
[in] address Application server address

Definition at line 705 of file equilibrium-mgmt_conn.c.

References notification_msg_s::action, server_info_s::app_name, server_info_s::app_name_len, notification_msg_s::message, notification_msg_s::message_len, MSG_DELETE_SERVER, server_info_s::server_addr, and notification_msg_s::svc_set_name.

Referenced by delete_server().

void notify_server_update ( const char *  svc_set_name,
const char *  app_name,
in_addr_t  address 
)

Enqueue a message to go to the data component about a server update

Parameters:
[in] svc_set_name Service set name
[in] app_name Application name
[in] address Application server address

Definition at line 661 of file equilibrium-mgmt_conn.c.

References notification_msg_s::action, server_info_s::app_name, server_info_s::app_name_len, notification_msg_s::message, notification_msg_s::message_len, MSG_CONF_SERVER, server_info_s::server_addr, and notification_msg_s::svc_set_name.

Referenced by TAILQ_HEAD(), and update_server().

void notify_serviceset_delete ( const char *  svc_set_name,
uint16_t  svc_set_id 
)

Enqueue a message to go to the data component about a service set deletion

Parameters:
[in] svc_set_name Service set name
[in] svc_set_id Service set ID (We need it now for deletions since it won't be available later)

Definition at line 845 of file equilibrium-mgmt_conn.c.

References notification_msg_s::action, notification_msg_s::message, notification_msg_s::message_len, MSG_DELETE_SS, del_svcset_info_s::svc_set_id, and notification_msg_s::svc_set_name.

Referenced by delete_service_set().

void process_notifications ( void   ) 

Try to process all notification requests that have been buffered. This should be called when a configuration load is complete.

Definition at line 561 of file equilibrium-mgmt_conn.c.

References eq_ctx, LOG, process_notifications_messages(), RETRY_INTERVAL, and timer_id.

Referenced by equilibrium_config_read(), and TAILQ_HEAD().

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

Go through the buffered messages and send them to the data component if it's connected. If it's not we recall this function in RETRY_INTERVAL seconds. Also we only process messages for which we can resolve the service set ID from the name.

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 313 of file equilibrium-mgmt_conn.c.

References notification_msg_s::action, data_session, eq_ctx, get_ssrb_by_name(), LOG, notification_msg_s::message, notification_msg_s::message_len, MSG_CONF_APPLICATION, MSG_CONF_SERVER, MSG_DELETE_ALL, MSG_DELETE_ALL_SERVERS, MSG_DELETE_APP, MSG_DELETE_SERVER, MSG_DELETE_SS, RETRY_INTERVAL, update_app_info_s::svc_set_id, server_info_s::svc_set_id, del_app_info_s::svc_set_id, notification_msg_s::svc_set_name, and timer_id.

Referenced by process_notifications().

static status_t receive_message ( pconn_session_t *  session,
ipc_msg_t *  msg,
void *cookie  __unused 
) [static]

Message handler for open connections. We receive all kinds of messages (msg_type_e) except MSG_PEER.

Parameters:
[in] session The session information for the source peer
[in] msg The inbound message
[in] cookie The cookie we passed in. This is the eventlib context here.
Returns:
SUCCESS if successful; otherwise EFAIL with an error message.

Definition at line 230 of file equilibrium-mgmt_conn.c.

References sessions_status_s::active_sessions, sessions_status_s::app_name, server_status_s::app_name, sessions_status_s::app_name_len, server_status_s::app_name_len, data_session, LOG, MSG_SERVER_UPDATE, MSG_STATUS_UPDATE, server_status_s::server_addr, server_status_s::server_status, set_app_sessions(), set_server_status(), sessions_status_s::svc_set_id, and server_status_s::svc_set_id.

Referenced by init_server().

static TAILQ_HEAD ( notification_buffer_s  ,
notification_msg_s   
) [static]

List of notification messages to buffer while SSRB info becomes available and while data component isn't connected

Definition at line 63 of file equilibrium-mgmt_conn.c.

References eq_app_s::application_addr, eq_app_s::application_name, eq_app_s::application_port, eq_smon_s::connection_interval, eq_smon_s::connection_timeout, data_info, data_session, eq_smon_s::down_retry_interval, LOG, next_application(), next_service_set(), notify_application_update(), notify_delete_all(), notify_server_update(), process_notifications(), eq_server_s::server_addr, eq_app_s::server_mon_params, eq_app_s::servers, eq_app_s::session_timeout, eq_serviceset_s::svc_set_name, and eq_smon_s::timeouts_allowed.


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