28 #ifndef AsyncComm_HandlerMap_h
29 #define AsyncComm_HandlerMap_h
47 #include <condition_variable>
58 class IOHandlerAccept;
218 std::lock_guard<std::mutex> lock(
m_mutex);
443 #endif // AsyncComm_HandlerMap_h
std::set< IOHandler * > m_decomissioned_handlers
Decomissioned handler set.
std::string String
A String is simply a typedef to std::string.
I/O handler for datagram (UDP) sockets.
int checkout_handler(const CommAddress &addr, IOHandlerAccept **handler)
Checks out accept I/O handler associated with addr.
bool wait_for_proxy_map(Timer &timer)
Waits for proxy map to get updated from a proxy map update message received from the master...
Declarations for IOHandlerDatagram.
void decomission_handler_unlocked(IOHandler *handler)
Decomissions handler.
Declarations for CommAddress.
void update_proxy_map(const char *message, size_t message_len)
Updates the proxy map with a proxy map update message received from the proxy master.
int set_alias(const InetAddr &addr, const InetAddr &alias)
Sets an alias address for an existing TCP address in map.
std::condition_variable m_cond_proxy
Condition variable for signalling proxy map load.
bool destroy_ok(IOHandler *handler)
Determines if handler can be destoryed.
SockAddrMap< IOHandlerAccept * > m_accept_handler_map
Accept map (InetAddr-to-IOHandlerAccept)
Declarations for IOHandlerRaw.
Data structure for mapping socket addresses to I/O handlers.
int remove_handler_unlocked(IOHandler *handler)
Removes handler from map without locking m_mutex.
Declarations for ProxyMap.
bool m_proxies_loaded
Flag indicating if proxy map has been loaded.
std::shared_ptr< HandlerMap > HandlerMapPtr
Smart pointer to HandlerMap.
Unordered map specialization for InetAddr keys.
IOHandlerAccept * lookup_accept_handler(const InetAddr &addr)
Finds accept I/O handler associated with addr.
int remove_proxy(const String &proxy)
Removes a proxy name from the proxy map.
Encapsulate an internet address.
ProxyMap m_proxy_map
Proxy map.
std::mutex m_mutex
Mutex for serializing concurrent access
IOHandlerRaw * lookup_raw_handler(const InetAddr &addr)
Finds raw I/O handler associated with addr.
int remove_handler(IOHandler *handler)
Removes handler from map.
A timer class to keep timeout states across AsyncComm related calls.
Logging routines and macros.
std::unordered_map< String, ProxyAddressInfo > ProxyMapT
Forward mapping hash type from proxy name to ProxyAddressInfo.
IOHandlerData * lookup_data_handler(const InetAddr &addr)
Finds data (TCP) I/O handler associated with addr.
void insert_handler(IOHandlerAccept *handler)
Inserts an accept handler.
Base class for socket descriptor I/O handlers.
I/O handler for TCP sockets.
void purge_handler(IOHandler *handler)
Purges (removes) handler.
Time related declarations.
Declarations for IOHandlerData.
void wait_for_empty()
Waits for map to become empty.
Declarations for SockAddrMap.
SockAddrMap< IOHandlerDatagram * > m_datagram_handler_map
Datagram (UDP) map (InetAddr-to-IOHandlerDatagram)
void get_proxy_map(ProxyMapT &proxy_map)
Returns the proxy map.
Declarations for CommBuf.
SockAddrMap< IOHandlerRaw * > m_raw_handler_map
Raw map (InetAddr-to-IOHandlerRaw)
int contains_data_handler(const CommAddress &addr)
Checks to see if addr is contained in map.
void decomission_all()
Decomissions all handlers.
A timer class to keep timeout states across AsyncComm related calls.
bool translate_proxy_address(const CommAddress &proxy_addr, InetAddr *addr)
Translates proxy_addr to its corresponding IPV4 address.
void decrement_reference_count(IOHandler *handler)
Decrements the reference count of handler.
int translate_address(const CommAddress &addr, InetAddr *inet_addr)
Translates addr to an InetAddr (IP address).
I/O handler for accept (listen) sockets.
int32_t propagate_proxy_map(IOHandlerData *handler)
Sends the current proxy map over connection identified by handler.
SockAddrMap< IOHandlerData * > m_data_handler_map
Data (TCP) map (InetAddr-to-IOHandlerData)
void alias(const String &cmdline_opt, const String &file_opt, bool overwrite)
Setup command line option alias for config file option.
Maps a set of proxy names to their associated IP addresses.
IOHandlerDatagram * lookup_datagram_handler(const InetAddr &addr)
Finds datagram I/O handler associated with addr.
void decomission_handler(IOHandler *handler)
Decomissions handler with m_mutex locked.
int add_proxy(const String &proxy, const String &hostname, const InetAddr &addr)
Adds or updates proxy information.
Error codes, Exception handling, error logging.
I/O handler for raw sockets.
std::condition_variable m_cond
Condition variable for signalling empty map.
Address abstraction to hold either proxy name or IPv4:port address.