junos_sync.h File Reference

Definitions for MultiServices PIC data synchronization by MP SDK daemons. More...


Data Structures

struct  junos_sync_tlv_s
 TLV data structure for encoded data. More...
struct  junos_sync_getnext_data_s
 Data structure to hold getnext data. More...
struct  junos_sync_peer_info_s
 Peer information: shows the role of the PIC as a master or slave, whether it is currently connected with a peer, and connection information. More...
struct  junos_sync_state_s
 This data structure encapsulates all data provided to the JUNOS sync system during initialization. More...
struct  junos_sync_statistics_s
 Sync subsystem statistics. More...
struct  junos_sync_callbacks_s
 Callback functions. More...

Typedefs

typedef junos_sync_context_s junos_sync_context_t
 Sync context.
typedef enum junos_sync_status_e junos_sync_status_t
 Error codes returned from the API.
typedef junos_sync_tlv_s junos_sync_tlv_t
 TLV data structure for encoded data.
typedef junos_sync_getnext_data_s junos_sync_getnext_data_t
 Data structure to hold getnext data.
typedef junos_sync_peer_info_s junos_sync_peer_info_t
 Peer information: shows the role of the PIC as a master or slave, whether it is currently connected with a peer, and connection information.
typedef junos_sync_state_s junos_sync_state_t
 This data structure encapsulates all data provided to the JUNOS sync system during initialization.
typedef junos_sync_statistics_s junos_sync_statistics_t
 Sync subsystem statistics.
typedef enum junos_sync_conn_status_e junos_sync_conn_status_t
 Connection status types.
typedef void(* junos_sync_ack_notify_func_t )(junos_sync_tlv_t *data, size_t len)
 Function to notify applications that a data block has been received and acknowledged by the peer. Data length.
typedef void(* junos_sync_data_decode_func_t )(void *data, size_t len)
 Function to decode application data. Data length.
typedef void *(* junos_sync_data_getnext_func_t )(void *current_node, junos_sync_getnext_data_t *data)
 Function to iterate over the application database for resync.
typedef void(* junos_sync_conn_status_change_func_t )(junos_sync_conn_status_t conn_status)
 Function to report a status change in the TCP connection.
typedef void(* junos_sync_init_sync_done_func_t )(size_t num_entries_synced)
 Function to report that initial sync between master and slave has been completed.
typedef void(* junos_sync_bind_done_func_t )(in_port_t server_port)
 Function to report that bind() is completed so the application can register the address and port with the name resolution system.
typedef void(* junos_sync_log_msg_func_t )(const char *fmt,...)
 Function to log error messages in the JUNOS sync subsystem.
typedef void *(* junos_sync_malloc_func_t )(size_t size)
 Function to allocate dynamic memory from the system.
typedef void(* junos_sync_free_func_t )(void *ptr)
 Function to free dynamic memory to the system.
typedef void(* junos_sync_db_clear_func_t )(void)
 Function to clear the replication database.
typedef junos_sync_callbacks_s junos_sync_callbacks_t
 Callback functions.

Enumerations

enum  junos_sync_status_e {
  JUNOS_SYNC_OK = 0, JUNOS_SYNC_ERR = -1, JUNOS_SYNC_ENOMEM = -2, JUNOS_SYNC_ENOTCONN = -3,
  JUNOS_SYNC_ENOTRESYNCED = -4, JUNOS_SYNC_EINVAL = -5, JUNOS_SYNC_EEXIST = -6, JUNOS_SYNC_ENOEVENTCTX = -7
}
 Error codes returned from the API. More...
enum  junos_sync_conn_status_e { JUNOS_SYNC_CONN_DOWN, JUNOS_SYNC_CONN_READY }
 Connection status types. More...

Functions

junos_sync_status_t junos_sync_exit (junos_sync_context_t *sync_ctx)
junos_sync_context_tjunos_sync_init (junos_sync_state_t *psync_state, junos_sync_callbacks_t *psync_callbacks)
void junos_sync_get_peer_info (junos_sync_context_t *sync_ctx, junos_sync_peer_info_t *peer_info)
void junos_sync_get_statistics (junos_sync_context_t *sync_ctx, junos_sync_statistics_t *statistics)
junos_sync_status_t junos_sync_queue (junos_sync_context_t *sync_ctx, junos_sync_tlv_t *data, bool ack_required)
void junos_sync_show_queues (junos_sync_context_t *sync_ctx)
junos_sync_status_t junos_sync_set_event_context (junos_sync_context_t *sync_ctx, evContext ctx)
junos_sync_status_t junos_sync_start (junos_sync_context_t *sync_ctx)
junos_sync_status_t junos_sync_start_event_loop (junos_sync_context_t *sync_ctx)
junos_sync_status_t junos_sync_stop (junos_sync_context_t *sync_ctx)
junos_sync_status_t junos_sync_stop_event_loop (junos_sync_context_t *sync_ctx)
junos_sync_status_t junos_sync_switchover (junos_sync_context_t *sync_ctx, junos_sync_state_t *psync_state, junos_sync_callbacks_t *psync_callbacks)


Detailed Description

Definitions for MultiServices PIC data synchronization by MP SDK daemons.


Typedef Documentation

typedef void(* junos_sync_ack_notify_func_t)(junos_sync_tlv_t *data, size_t len)
 

Function to notify applications that a data block has been received and acknowledged by the peer. Data length.

Parameters:
[in] data Pointer to the acknowledged data
[in] len Data length

typedef void(* junos_sync_bind_done_func_t)(in_port_t server_port)
 

Function to report that bind() is completed so the application can register the address and port with the name resolution system.

The server IP address needs to be provided by applications since the bind() operation takes place with the INADDR_ANY - the exact address is not known at this moment. Currently, only TCP over IPv4 is supported.

Parameters:
[in] server_port TCP server port

typedef struct junos_sync_callbacks_s junos_sync_callbacks_t
 

Callback functions.

Applications need to provide these callbacks to the JUNOS sync system.

typedef void(* junos_sync_conn_status_change_func_t)(junos_sync_conn_status_t conn_status)
 

Function to report a status change in the TCP connection.

Parameters:
[in] conn_status Current connection status

typedef void(* junos_sync_data_decode_func_t)(void *data, size_t len)
 

Function to decode application data. Data length.

The called routine is expected to decode the data block and do whatever it wishes with the results (typically doing something to a replication database). This callback is called by the slave to notify the application that a data block is received. Please note: the data here is not pointing to the encoded TLV format data; it is pointing to the data with TLV headers stripped off.

Parameters:
[in] data Pointer to data to be decoded
[in] len Data length

typedef void*(* junos_sync_data_getnext_func_t)(void *current_node, junos_sync_getnext_data_t *data)
 

Function to iterate over the application database for resync.

current_node points to the node in the application database, and is opaque to the library. The function returns a pointer to the next node in the application database; again, the return node is opaque to the library. This function also passes out the encoded data in a linear buffer for the return next node. The junos_sync library owns this linear buffer and frees it after sending this data to the peer; if acknoweldgement is required, the buffer is freed after the acknowledgment is received. This function is called during initial synchronization after the slave connects, assuming no_resync in junos_sync_state_t setup is false.

Parameters:
[in] current_node Pointer to the current node in the application database (opaque to the library.)
[in] data Pointer to the encoded data buffer for the next node (allocated by the library.)
Returns:
Pointer to the next node in the application database

typedef void(* junos_sync_db_clear_func_t)(void)
 

Function to clear the replication database.

This is called when a connection is established in order to keep the replicate database in a clean state.

typedef void(* junos_sync_free_func_t)(void *ptr)
 

Function to free dynamic memory to the system.

Parameters:
[in] ptr Pointer to the buffer to be freed

typedef void(* junos_sync_init_sync_done_func_t)(size_t num_entries_synced)
 

Function to report that initial sync between master and slave has been completed.

This is called only by the master.

Parameters:
[in] num_entries_synced Number of entries synced

typedef void(* junos_sync_log_msg_func_t)(const char *fmt,...)
 

Function to log error messages in the JUNOS sync subsystem.

Parameters:
[in] fmt Format of the error message

typedef void*(* junos_sync_malloc_func_t)(size_t size)
 

Function to allocate dynamic memory from the system.

Parameters:
[in] size Size of the buffer to be allocated
Returns:
Pointer to the buffer allocated


Enumeration Type Documentation

enum junos_sync_conn_status_e
 

Connection status types.

Enumerator:
JUNOS_SYNC_CONN_DOWN  Connection went down.
JUNOS_SYNC_CONN_READY  Connection came up.

enum junos_sync_status_e
 

Error codes returned from the API.

Enumerator:
JUNOS_SYNC_OK  Operation succeeded.
JUNOS_SYNC_ERR  Generic error.
JUNOS_SYNC_ENOMEM  Out of memory.
JUNOS_SYNC_ENOTCONN  Socket is not connected.
JUNOS_SYNC_ENOTRESYNCED  System is not resynced.
JUNOS_SYNC_EINVAL  Invalid argument.
JUNOS_SYNC_EEXIST  Already exists.
JUNOS_SYNC_ENOEVENTCTX  No event context 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:23:55 2010 for libjunos-sync by Doxygen 1.4.5