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 fwsocket * make_socket (int family, int type, int proto, void *ssl)
 Allocate a socket structure and return reference. More...
 
struct fwsocket * accept_socket (struct fwsocket *sock)
 Create and return a socket structure from accept() More...
 
struct fwsocket * sockconnect (int family, int stype, int proto, const char *ipaddr, const char *port, void *ssl)
 Generic client socket. More...
 
struct fwsocket * udpconnect (const char *ipaddr, const char *port, void *ssl)
 UDP Socket client. More...
 
struct fwsocket * tcpconnect (const char *ipaddr, const char *port, void *ssl)
 TCP Socket client. More...
 
struct fwsocket * sockbind (int family, int stype, int proto, const char *ipaddr, const char *port, void *ssl, int backlog)
 Generic server socket. More...
 
struct fwsocket * udpbind (const char *ipaddr, const char *port, void *ssl)
 UDP server socket. More...
 
struct fwsocket * tcpbind (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 fwsocket * mcast_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.