#ifndef H_xsock_H
#define H_xsock_H
/* Interface to sockets with possibly enhanced behaviour

$Id: xsock,v 1.6 2001/03/11 17:39:02 joseph Exp $

*/

#ifdef HAVE_STDBOOL_H
# include <stdbool.h>
#endif

#include "sys/types.h"
#include "netdb.h"
#include "netinet/in.h"

#include "dnslib.h"

typedef int xsock;

struct hostent *xsock_gethostbyname(const char *, dns_t **);

xsock xsock_create(int /*af*/, int /*type*/, int /*protocol*/);

int xsock_connect(xsock, const struct sockaddr */*name*/, int /*namelen*/);

void xsock_close(xsock);

int xsock_read(xsock, char */*data*/, int /*len*/);

/* Wrapper for xsock_write, adds "\r\n" and logs errors etc */
bool xsock_xwrite(xsock, const char *);

/* As above, but without debug logging (for sending body text) */
bool xsock_ywrite(xsock, const char *);

bool xsock_ywritelen(xsock, const char *, int /*len*/);

#endif
