diff options
author | Robert James Kaes <rjkaes@users.sourceforge.net> | 2000-09-11 23:56:32 +0000 |
---|---|---|
committer | Robert James Kaes <rjkaes@users.sourceforge.net> | 2000-09-11 23:56:32 +0000 |
commit | f6b7fe3f5ceb6709363e77efc8a24fb837c9ec6b (patch) | |
tree | 56e3f931d06d26d852c37b3233426bdd0e930237 /src/sock.h | |
parent | c0ff35dd220ffa95234deaabf08b5e1e1c77b465 (diff) |
Needed locking in getpeer_string().
Added mutex locking around the dnscache() call.
Removed the global sockaddr and setup_fd variables.
Added the socket_blocking() and socket_nonblocking() functions.
Gutted the readling() function and replaced it with something similar to
the 1.0 version. :)
Diffstat (limited to 'src/sock.h')
-rw-r--r-- | src/sock.h | 22 |
1 files changed, 10 insertions, 12 deletions
@@ -1,4 +1,4 @@ -/* $Id: sock.h,v 1.1.1.1 2000-02-16 17:32:23 sdyoung Exp $ +/* $Id: sock.h,v 1.2 2000-09-11 23:56:32 rjkaes Exp $ * * See 'sock.c' for a detailed description. * @@ -16,25 +16,23 @@ * General Public License for more details. */ -#ifndef _SOCK_H_ -#define _SOCK_H_ 1 - -#include "buffer.h" +#ifndef _TINYPROXY_SOCK_H_ +#define _TINYPROXY_SOCK_H_ #define PEER_IP_LENGTH 16 #define PEER_STRING_LENGTH 256 -extern int setup_fd; +#define MAXLINE (1024 * 4) extern int opensock(char *ip_addr, int port); -extern int opensock_inaddr(struct in_addr *inaddr, int port); -extern int init_listen_sock(int port); -extern int listen_sock(void); -extern void de_init_listen_sock(void); -extern int setsocketopt(int *sock_fd, int options, int flip); +extern int listen_sock(unsigned int port, socklen_t *addrlen); + +extern int socket_nonblocking(int sock); +extern int socket_blocking(int sock); extern char *getpeer_ip(int fd, char *ipaddr); extern char *getpeer_string(int fd, char *string); -extern int readline(int fd, struct buffer_s *buffer, char **line); + +extern ssize_t readline(int fd, void *vptr, size_t maxlen); #endif |