B2BITS FIX Antenna HFT  1.0.16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Macros | Typedefs | Functions | Variables
sockets_iface.h File Reference
#include <stdio.h>
#include "b2b_platform.h"
#include "sockets_session.h"
#include "sockets_logging.h"
+ Include dependency graph for sockets_iface.h:

Classes

struct  Server
 
struct  Socket
 
struct  SocketEvents
 
struct  SocketMethods
 
struct  Sockets
 
struct  SocketThread
 

Macros

#define CONNECT_TIMEOUT_MS   (10 * 1000)
 
#define MAX_LISTENING_SOCKETS   128
 
#define MAX_RUNTIME_SOCKETS_ON_SERVER   32
 
#define MS_BETWEEN_LOGCLIENT_TIMESLICES   500
 
#define MS_BETWEEN_RECONNECTS   3000
 
#define NANOSEC_IN_MS   1000000LL
 
#define SOCKET_RECV_BUF_SIZE   65536
 
#define SOCKET_THREAD_TIME_ACCESS_THROTTLE   10
 

Typedefs

typedef struct Socket Socket
 
typedef void(* SOCKET_ctor )(struct Socket *sock, struct Server *srv, int fd, int isListening, enum SocketID socketID, void *data)
 
typedef void(* SOCKET_dtor )(struct Socket *sock)
 
typedef int(* SOCKET_event_before_new_data_received )(struct Socket *sock)
 
typedef void(* SOCKET_event_can_write_nonblock )(struct Socket *sock)
 
typedef void(* SOCKET_event_disconnected )(struct Socket *sock)
 
typedef void(* SOCKET_event_incoming_connection_accepted )(struct Socket *sock)
 
typedef void(* SOCKET_event_new_data_received )(struct Socket *sock, char *buf, int len)
 
typedef void(* SOCKET_event_new_data_received_appended )(struct Socket *sock, char *buf, int startPos, int len)
 
typedef void(* SOCKET_event_outgoing_connected )(struct Socket *sock)
 
typedef void(* SOCKET_event_socket_closed )(struct Socket *sock)
 
typedef void(* SOCKET_event_socket_created )(struct Socket *sock)
 
typedef int(* SOCKET_getAddrAny )(int port, struct sockaddr_in *sin)
 
typedef int(* SOCKET_getAddrByName )(const char *hostAddr, int port, struct sockaddr_in *sin)
 
typedef int(* SOCKET_initSocketOptions )(struct Server *srv, int fd)
 
typedef int(* SOCKET_isConnected )(int fd)
 
typedef int(* SOCKET_recv_zero_copy )(struct Socket *sock, char **buf)
 
typedef int(* SOCKET_setNonblocking )(int fd)
 
typedef int(* SOCKET_setRecvBufferSize )(int fd, int size)
 
typedef int(* SOCKET_setSendBufferSize )(int fd, int size)
 
typedef int(* SOCKET_socket )(struct Server *srv, enum SocketID localSocketID)
 
typedef void(* SOCKET_socket_write_lock )(struct Socket *sock, int doLock)
 

Functions

V12_API void _initLoggerClient (struct SocketThread *thread)
 
V12_API void _initLoggerClient2 (struct SocketThread *thread, enum ServerID serverID, enum SocketID logSocketID)
 
V12_API struct Socketadd_socket (struct Server *srv, struct SocketMethods *type, int fd, int isListening, enum SocketID socketID, int connecting, void *socket_data)
 
V12_API void addListeningSocket (struct Server *srv, enum SocketID socketID)
 
V12_API struct ServeraddServerToThread (struct SocketThread *thread, struct NetworkDeclaration *netDecl, enum ServerID serverID, struct SocketEvents *eventMethods)
 
V12_API int getListenSocket (enum SocketID socketID, struct Server *hostingServer, struct Socket **returnSocket)
 
V12_API int getServerDecl (enum ServerID serverID, struct NetworkDeclaration *net, struct ServerDeclaration **decl)
 
V12_API struct ServergetServerFromThread (struct SocketThread *thread, enum ServerID id)
 
V12_API int getSocket (enum SocketID socketID, struct Server *hostingServer, struct Socket **returnSocket)
 
V12_API int getSocketDecl (enum SocketID socketID, struct NetworkDeclaration *net, struct SocketDeclaration **decl)
 
V12_API void remove_socket (struct Sockets *socks, int sock)
 
V12_API int socket_alloc_recvbuf (struct Socket *sock, int len)
 
static int socket_can_write (struct Socket *sock)
 
V12_API void socket_close (struct Socket *sock)
 
V12_API struct Socketsocket_connect (struct Server *srv, const char *address, int port, enum SocketID localSocketID, void *socket_data)
 
V12_API struct Socketsocket_connect_blocking (struct Server *srv, const char *address, int port, enum SocketID localSocketID, void *socket_data)
 
V12_API struct Socketsocket_connect_to_def_destination (struct Server *srv, enum SocketID localSocketID, void *socket_data)
 
V12_API struct Socketsocket_connect_to_def_destination_blocking (struct Server *srv, enum SocketID localSocketID, void *socket_data)
 
V12_API struct Socketsocket_connect_to_socket (struct Server *srv, enum SocketID localSocketID, struct NetworkDeclaration *remoteNet, enum SocketID remoteSocket, void *socket_data)
 
V12_API void socket_construct (struct Socket *newsock, struct Server *srv, struct SocketMethods *type, int fd, int isListening, enum SocketID socketID, void *socket_data)
 
V12_API void socket_ctor_def (struct Socket *sock, struct Server *srv, int fd, int isListening, enum SocketID socketID, void *data)
 
V12_API void socket_dtor_def (struct Socket *sock)
 
V12_API void socket_free_rcvbuf (struct Socket *sock)
 
static int socket_is_connected (struct Socket *sock)
 
V12_API int socket_realloc_recvbuf (struct Socket *sock, int len)
 
V12_API int socket_send (struct Socket *sock, const char *buf, int len)
 
V12_API int socket_send_blocking (struct Socket *sock, const char *buf, int len)
 
V12_API int socket_send_if_connected (struct Socket *sock, const char *buf, int len)
 
static void socket_set_recv_pos (struct Socket *sock, int pos)
 
V12_API void thread_construct (struct SocketThread *thread)
 
V12_API void thread_construct2 (struct SocketThread *thread, int createLogSocket)
 
int thread_init_listen_daemon (struct SocketThread *thread)
 
V12_API int thread_job_timeslice (struct SocketThread *thread)
 

Variables

struct SocketMethods FIFOSocketMethods
 
struct SocketMethods TCPSocketMethods
 

Macro Definition Documentation

#define CONNECT_TIMEOUT_MS   (10 * 1000)
#define MAX_LISTENING_SOCKETS   128
#define MAX_RUNTIME_SOCKETS_ON_SERVER   32
#define MS_BETWEEN_LOGCLIENT_TIMESLICES   500
#define MS_BETWEEN_RECONNECTS   3000
#define NANOSEC_IN_MS   1000000LL
#define SOCKET_RECV_BUF_SIZE   65536
#define SOCKET_THREAD_TIME_ACCESS_THROTTLE   10

Typedef Documentation

typedef struct Socket Socket
typedef void(* SOCKET_ctor)(struct Socket *sock, struct Server *srv, int fd, int isListening, enum SocketID socketID, void *data)
typedef void(* SOCKET_dtor)(struct Socket *sock)
typedef int(* SOCKET_event_before_new_data_received)(struct Socket *sock)
typedef void(* SOCKET_event_can_write_nonblock)(struct Socket *sock)
typedef void(* SOCKET_event_disconnected)(struct Socket *sock)
typedef void(* SOCKET_event_incoming_connection_accepted)(struct Socket *sock)
typedef void(* SOCKET_event_new_data_received)(struct Socket *sock, char *buf, int len)
typedef void(* SOCKET_event_new_data_received_appended)(struct Socket *sock, char *buf, int startPos, int len)
typedef void(* SOCKET_event_outgoing_connected)(struct Socket *sock)
typedef void(* SOCKET_event_socket_closed)(struct Socket *sock)
typedef void(* SOCKET_event_socket_created)(struct Socket *sock)
typedef int(* SOCKET_getAddrAny)(int port, struct sockaddr_in *sin)
typedef int(* SOCKET_getAddrByName)(const char *hostAddr, int port, struct sockaddr_in *sin)
typedef int(* SOCKET_initSocketOptions)(struct Server *srv, int fd)
typedef int(* SOCKET_isConnected)(int fd)
typedef int(* SOCKET_recv_zero_copy)(struct Socket *sock, char **buf)
typedef int(* SOCKET_setNonblocking)(int fd)
typedef int(* SOCKET_setRecvBufferSize)(int fd, int size)
typedef int(* SOCKET_setSendBufferSize)(int fd, int size)
typedef int(* SOCKET_socket)(struct Server *srv, enum SocketID localSocketID)
typedef void(* SOCKET_socket_write_lock)(struct Socket *sock, int doLock)

Function Documentation

V12_API void _initLoggerClient ( struct SocketThread thread)
V12_API void _initLoggerClient2 ( struct SocketThread thread,
enum ServerID  serverID,
enum SocketID  logSocketID 
)
V12_API struct Socket* add_socket ( struct Server srv,
struct SocketMethods type,
int  fd,
int  isListening,
enum SocketID  socketID,
int  connecting,
void *  socket_data 
)
V12_API void addListeningSocket ( struct Server srv,
enum SocketID  socketID 
)
V12_API struct Server* addServerToThread ( struct SocketThread thread,
struct NetworkDeclaration netDecl,
enum ServerID  serverID,
struct SocketEvents eventMethods 
)
V12_API int getListenSocket ( enum SocketID  socketID,
struct Server hostingServer,
struct Socket **  returnSocket 
)
V12_API int getServerDecl ( enum ServerID  serverID,
struct NetworkDeclaration net,
struct ServerDeclaration **  decl 
)
V12_API struct Server* getServerFromThread ( struct SocketThread thread,
enum ServerID  id 
)
V12_API int getSocket ( enum SocketID  socketID,
struct Server hostingServer,
struct Socket **  returnSocket 
)
V12_API int getSocketDecl ( enum SocketID  socketID,
struct NetworkDeclaration net,
struct SocketDeclaration **  decl 
)
V12_API void remove_socket ( struct Sockets socks,
int  sock 
)
V12_API int socket_alloc_recvbuf ( struct Socket sock,
int  len 
)
static int socket_can_write ( struct Socket sock)
inlinestatic
V12_API void socket_close ( struct Socket sock)
V12_API struct Socket* socket_connect ( struct Server srv,
const char *  address,
int  port,
enum SocketID  localSocketID,
void *  socket_data 
)
V12_API struct Socket* socket_connect_blocking ( struct Server srv,
const char *  address,
int  port,
enum SocketID  localSocketID,
void *  socket_data 
)
V12_API struct Socket* socket_connect_to_def_destination ( struct Server srv,
enum SocketID  localSocketID,
void *  socket_data 
)
V12_API struct Socket* socket_connect_to_def_destination_blocking ( struct Server srv,
enum SocketID  localSocketID,
void *  socket_data 
)
V12_API struct Socket* socket_connect_to_socket ( struct Server srv,
enum SocketID  localSocketID,
struct NetworkDeclaration remoteNet,
enum SocketID  remoteSocket,
void *  socket_data 
)
V12_API void socket_construct ( struct Socket newsock,
struct Server srv,
struct SocketMethods type,
int  fd,
int  isListening,
enum SocketID  socketID,
void *  socket_data 
)
V12_API void socket_ctor_def ( struct Socket sock,
struct Server srv,
int  fd,
int  isListening,
enum SocketID  socketID,
void *  data 
)
V12_API void socket_dtor_def ( struct Socket sock)
V12_API void socket_free_rcvbuf ( struct Socket sock)
static int socket_is_connected ( struct Socket sock)
inlinestatic

References Socket::connecting.

V12_API int socket_realloc_recvbuf ( struct Socket sock,
int  len 
)
V12_API int socket_send ( struct Socket sock,
const char *  buf,
int  len 
)
V12_API int socket_send_blocking ( struct Socket sock,
const char *  buf,
int  len 
)
V12_API int socket_send_if_connected ( struct Socket sock,
const char *  buf,
int  len 
)
static void socket_set_recv_pos ( struct Socket sock,
int  pos 
)
inlinestatic

References Socket::recvPos.

V12_API void thread_construct ( struct SocketThread thread)
V12_API void thread_construct2 ( struct SocketThread thread,
int  createLogSocket 
)
int thread_init_listen_daemon ( struct SocketThread thread)
V12_API int thread_job_timeslice ( struct SocketThread thread)

Variable Documentation

struct SocketMethods FIFOSocketMethods
struct SocketMethods TCPSocketMethods