tinyproxy/src/network.h
Robert James Kaes c21df1ea0f Added two functions:
- get_ip_string() converts a binary network address into either a
   dotted-decimal IPv4 address, or a IPv6 hex-string
 - full_inet_pton() converts a numeric character string into an IPv6
   network address (binary form).  It's like the system inet_pton()
   function, but it will work with bot IPv4 and IPv6 character
   strings.

These functions are required for the conversion to Internet protocol
independence.  (Or to put it more clearly: allow tinyproxy to work in
an IPv6 network.)
2004-02-18 20:17:18 +00:00

31 lines
1.1 KiB
C

/* $Id: network.h,v 1.2 2004-02-18 20:17:18 rjkaes Exp $
*
* See 'network.c' for a detailed description.
*
* Copyright (C) 2002,2004 Robert James Kaes (rjkaes@users.sourceforge.net)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*/
#ifndef TINYPROXY_NETWORK_H
#define TINYPROXY_NETWORK_H
extern ssize_t safe_write(int fd, const char *buffer, size_t count);
extern ssize_t safe_read(int fd, char *buffer, size_t count);
extern int write_message(int fd, const char *fmt, ...);
extern ssize_t readline(int fd, char **whole_buffer);
extern char* get_ip_string(struct sockaddr* sa, char* buf, size_t len);
extern int full_inet_pton(const char* ip, void* dst);
#endif