DTS Application Library  0.2.3
Application library containing referenced objects and interfaces to common libraries
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
socket.c File Reference

Allocate and initialise a socket for use as a client or server. More...

#include <netdb.h>
#include <unistd.h>
#include <stdint.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <fcntl.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include "include/dtsapp.h"
#include "include/private.h"

Go to the source code of this file.

Data Structures

struct  socket_handler
 Socket handling thread data. More...
 

Functions

void close_socket (struct fwsocket *sock)
 Mark the socket for closure and release the reference. More...
 
struct fwsocketmake_socket (int family, int type, int proto, void *ssl)
 Allocate a socket structure and return reference. More...
 
struct fwsocketaccept_socket (struct fwsocket *sock)
 Create and return a socket structure from accept() More...
 
struct fwsocketsockconnect (int family, int stype, int proto, const char *ipaddr, const char *port, void *ssl)
 Generic client socket. More...
 
struct fwsocketudpconnect (const char *ipaddr, const char *port, void *ssl)
 UDP Socket client. More...
 
struct fwsockettcpconnect (const char *ipaddr, const char *port, void *ssl)
 TCP Socket client. More...
 
struct fwsocketsockbind (int family, int stype, int proto, const char *ipaddr, const char *port, void *ssl, int backlog)
 Generic server socket. More...
 
struct fwsocketudpbind (const char *ipaddr, const char *port, void *ssl)
 UDP server socket. More...
 
struct fwsockettcpbind (const char *ipaddr, const char *port, void *ssl, int backlog)
 Generic server socket. More...
 
void socketserver (struct fwsocket *sock, socketrecv read, socketrecv acceptfunc, threadcleanup cleanup, void *data)
 Create a server thread with a socket that has been created with sockbind udpbind or tcpbind. More...
 
void socketclient (struct fwsocket *sock, void *data, socketrecv read, threadcleanup cleanup)
 Create a server thread with a socket that has been created with sockbind udpbind or tcpbind. More...
 
const char * sockaddr2ip (union sockstruct *addr, char *buff, int blen)
 Return the ip address of a sockstruct addr. More...
 
struct fwsocketmcast_socket (const char *iface, int family, const char *mcastip, const char *port, int flags)
 Create a multicast socket. More...
 

Detailed Description

Allocate and initialise a socket for use as a client or server.

This is part of the socket interface to upport encrypted sockets a ssldata refernece will be created and passed on socket initialization.

See Also
SSL socket support

Definition in file socket.c.