#include <xdas_base.h>
#include <xdasd.h>
#include "xdasd_filter.h"
#include "xdasd_event.h"
#include "xdasd_list.h"
#include "xdasd_net.h"
#include "xdasd_log.h"
#include <malloc.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <fcntl.h>
Go to the source code of this file.
Data Structures | |
struct | XDASD_Socket_tag |
Defines | |
#define | so_bool_t int |
#define | BAD_SOCKET -1 |
#define | closesocket close |
XDASD socket status field values. | |
#define | SOCKET_UNUSED 0 |
#define | SOCKET_CLOSE 1 |
#define | SOCKET_LISTEN 2 |
#define | STREAM_READ_FIRST 3 |
#define | STREAM_READ 4 |
#define | STREAM_WRITE_FIRST 5 |
#define | STREAM_WRITE 6 |
Typedefs | |
typedef struct XDASD_Socket_tag | XDASD_Socket |
Functions | |
static XDASD_Socket * | xdasd_socket_alloc (void) |
static void | xdasd_socket_free (XDASD_Socket *sock) |
static int | xdasd_socket_error (void) |
static int | xdasd_set_nonblocking (sockfd_t fd) |
static XDASD_Socket * | xdasd_create_listen_socket (const char *ipcpath) |
static void | xdasd_accept (XDASD_Socket *sock) |
static int | xdasd_net_dispatch (XDASD_Socket *sock) |
static void | xdasd_write_stream (XDASD_Socket *sock) |
static void | xdasd_read_stream (XDASD_Socket *sock) |
int | xdasd_net_init (const char *ipcpath) |
Initialize the inbound socket list. | |
void | xdasd_net_load_fdsets (int *highfd, fd_set *readfds, fd_set *writefds) |
Configures fd_set objects with sockets from a specified socket list. | |
void | xdasd_net_event_handler (int fdcount, fd_set *readfds, fd_set *writefds) |
Scan a set of socket descriptors for connect/read/write indications. | |
void | xdasd_net_exit (void) |
Cleanup xdasd socket list. | |
Variables | |
static XDList | s_socklist = {0, 0, 0} |
This module manages all aspects of the local (unix-domain or loopback socket) channel between the instrumentation library and the OpenXDAS daemon. Local channel protocol:
client --> (req/function/data) --> server client <-- (ack/ecode/response) <-- server
Definition in file xdasd_net.c.
typedef struct XDASD_Socket_tag XDASD_Socket |
static void xdasd_accept | ( | XDASD_Socket * | sock | ) | [static] |
Definition at line 305 of file xdasd_net.c.
References BAD_SOCKET, XDASD_Socket_tag::fd, XDASD_Socket_tag::item, XDASD_Socket_tag::localaddr, XDASD_Socket_tag::peeraddr, sockfd_t, XDASD_Socket_tag::state, STREAM_READ_FIRST, xdasd_list_link_head(), xdasd_set_nonblocking(), and xdasd_socket_alloc().
Referenced by xdasd_net_event_handler().
static XDASD_Socket* xdasd_create_listen_socket | ( | const char * | ipcpath | ) | [static] |
Definition at line 243 of file xdasd_net.c.
References BAD_SOCKET, XDASD_Socket_tag::fd, XDASD_Socket_tag::localaddr, so_bool_t, SOCKET_LISTEN, XDASD_Socket_tag::state, XDASD_RESERVED_PORT, xdasd_set_nonblocking(), xdasd_socket_alloc(), and xdasd_socket_free().
Referenced by xdasd_net_init().
static int xdasd_net_dispatch | ( | XDASD_Socket * | sock | ) | [static] |
Definition at line 343 of file xdasd_net.c.
References xdas_buffer_tag::curpos, xdas_buffer_tag::end, int(), OXDAS_MS_PROTOCOL, XDASD_Socket_tag::recvbuf, XDASD_Socket_tag::sendbuf, xdas_buffer_tag::start, xdas_buffer_get_uint32, xdas_buffer_put_uint32, xdas_buffer_realloc(), xdas_elemcount, XDAS_S_FAILURE, xdasd_event_process(), and xdasd_filter_process().
Referenced by xdasd_read_stream().
static void xdasd_read_stream | ( | XDASD_Socket * | sock | ) | [static] |
Definition at line 440 of file xdasd_net.c.
References AS_UINT32, xdas_buffer_tag::curpos, xdas_buffer_tag::end, XDASD_Socket_tag::fd, MAX_XDAS_MSG_SIZE, XDASD_Socket_tag::recvbuf, SOCKET_CLOSE, xdas_buffer_tag::start, XDASD_Socket_tag::state, STREAM_READ, STREAM_READ_FIRST, STREAM_WRITE_FIRST, xdas_buffer_realloc(), xdasd_log(), xdasd_net_dispatch(), and xdasd_write_stream().
Referenced by xdasd_net_event_handler().
static int xdasd_set_nonblocking | ( | sockfd_t | fd | ) | [static] |
Definition at line 214 of file xdasd_net.c.
References WSAGetLastError.
Referenced by xdasd_accept(), and xdasd_create_listen_socket().
static XDASD_Socket* xdasd_socket_alloc | ( | void | ) | [static] |
Definition at line 159 of file xdasd_net.c.
References BAD_SOCKET, XDASD_Socket_tag::fd, and malloc.
Referenced by xdasd_accept(), and xdasd_create_listen_socket().
static int xdasd_socket_error | ( | void | ) | [static] |
Definition at line 196 of file xdasd_net.c.
References WSAGetLastError.
Referenced by xdasd_write_stream().
static void xdasd_socket_free | ( | XDASD_Socket * | sock | ) | [static] |
Definition at line 178 of file xdasd_net.c.
References BAD_SOCKET, closesocket, XDASD_Socket_tag::fd, free, XDASD_Socket_tag::recvbuf, XDASD_Socket_tag::sendbuf, and xdas_buffer_free().
Referenced by xdasd_create_listen_socket(), xdasd_net_exit(), xdasd_net_init(), and xdasd_net_load_fdsets().
static void xdasd_write_stream | ( | XDASD_Socket * | sock | ) | [static] |
Definition at line 405 of file xdasd_net.c.
References xdas_buffer_tag::curpos, xdas_buffer_tag::end, XDASD_Socket_tag::fd, flags, XDASD_Socket_tag::sendbuf, SOCKET_CLOSE, xdas_buffer_tag::start, XDASD_Socket_tag::state, STREAM_READ_FIRST, STREAM_WRITE, STREAM_WRITE_FIRST, and xdasd_socket_error().
Referenced by xdasd_net_event_handler(), and xdasd_read_stream().
XDList s_socklist = {0, 0, 0} [static] |
Definition at line 150 of file xdasd_net.c.