Files
lcdproc/shared/sockets.h
T

46 lines
1.2 KiB
C
Raw Normal View History

2010-02-02 23:20:29 +00:00
/** \file shared/sockets.h
* Socket functions available to server and clients.
*/
1999-12-09 23:15:14 +00:00
#ifndef SOCKETS_H
#define SOCKETS_H
#include <stdlib.h>
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
1999-12-09 23:15:14 +00:00
#ifndef LCDPORT
# define LCDPORT 13666
#endif
#ifndef SHUT_RDWR
# define SHUT_RDWR 2
1999-12-09 23:15:14 +00:00
#endif
2010-02-02 23:20:29 +00:00
/** Connect to server on host, port */
int sock_connect (char *host, unsigned short int port);
2010-02-02 23:20:29 +00:00
/** Disconnect from server */
int sock_close (int fd);
2010-02-02 23:20:29 +00:00
/** Send printf-like formatted output */
int sock_printf (int fd, const char *format, .../*args*/);
2010-02-02 23:20:29 +00:00
/** Send lines of text */
int sock_send_string (int fd, char *string);
2010-02-02 23:20:29 +00:00
/** Send raw data */
int sock_send (int fd, void *src, size_t size);
2010-02-02 23:20:29 +00:00
/** Receive a line of text */
int sock_recv_string (int fd, char *dest, size_t maxlen);
/** Receive raw data */
int sock_recv (int fd, void *dest, size_t maxlen);
1999-12-09 23:15:14 +00:00
2010-02-02 23:20:29 +00:00
/** Return the error message for the last error occured */
char *sock_geterror(void);
2010-02-02 23:20:29 +00:00
/** Send an already formatted error message to the client */
2005-07-17 16:14:07 +00:00
int sock_send_error(int fd, char* message);
2010-02-02 23:20:29 +00:00
/** Print printf-like formatted output to logfile and send it to the client */
2005-07-17 16:14:07 +00:00
int sock_printf_error(int fd, const char *format, .../*args*/);
1999-12-09 23:15:14 +00:00
#endif