/*
 * socklib.h
 *
 * Handy functions for IPv4 socket sonnections.
 *
 * Limitations:
 * These are for the simplest case, as the recommended approach
 * is to integrate the sock_connect() timeout inside the main
 * loop as to don't be blocking.
 *
 * History:
 *      27/01/2014 Creation
 *
 * Author: Dario Rodriguez dario@softhome.net
 * This file is licensed under the terms of the GNU LGPL v2+
 */

#ifndef SOCKLIB_H
#define SOCKLIB_H

char *sock_genip(char *hostname, long *resulthostsize);
int sock_genport(char *portname, int fallback);
int sock_connect(char *host, long hostsize, int port);
int sock_server(int port);
int sock_serverbinded(char *host, long hostsize, int port);
int sock_getinfo(int socket, char *ip, int *port);
int sock_select(long timoutms, ...); /* int numfds, int *resfdreadgroup1, int *fdreadgroup1,...,-1,int numfds, int *resfdwritegroup1, int *fdwritegroup1,...,-1); */
int sock_queued(int socket);
int sock_setblocking(int socket, int block);
#endif