Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals

addr.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2005, 2006 by KoanLogic s.r.l. <http://www.koanlogic.com>
00003  * All rights reserved.
00004  *
00005  * This file is part of KLone, and as such it is subject to the license stated
00006  * in the LICENSE file which you have received as part of this distribution.
00007  *
00008  * $Id: addr.h,v 1.11 2006/05/27 16:34:01 tat Exp $
00009  */
00010 
00011 #ifndef _KLONE_ADDR_H_
00012 #define _KLONE_ADDR_H_
00013 
00014 #include <u/libu.h>
00015 
00016 #ifdef __cplusplus
00017 extern "C" {
00018 #endif 
00019 
00020 typedef struct addr_s
00021 {
00022     enum type_e { ADDR_IPV4, ADDR_IPV6, ADDR_UNIX } type;
00023     union
00024     {
00025         struct sockaddr_in  sin;
00026 #ifndef NO_IPV6
00027         struct sockaddr_in6 sin6;
00028 #endif
00029 #ifndef NO_UNIXSOCK
00030         struct sockaddr_un  sun;
00031 #endif
00032     } sa;
00033 } addr_t;
00034 
00035 int addr_create(addr_t **pa);
00036 int addr_set_from_config(addr_t *a, u_config_t *c);
00037 int addr_set_from_sa(addr_t *a, struct sockaddr *sa, size_t sz);
00038 int addr_set(addr_t *a, const char *ip, int port);
00039 int addr_set_ipv4_ip(addr_t *a, const char *ip);
00040 int addr_set_ipv4_port(addr_t *a, int port);
00041 int addr_free(addr_t *a);
00042 
00043 #ifdef __cplusplus
00044 }
00045 #endif 
00046 
00047 #endif

←Products
© 2005-2006 - KoanLogic S.r.l. - All rights reserved