libnl 1.1
|
00001 /* 00002 * netlink/addr.h Abstract Address 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation version 2.1 00007 * of the License. 00008 * 00009 * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch> 00010 */ 00011 00012 #ifndef NETLINK_ADDR_H_ 00013 #define NETLINK_ADDR_H_ 00014 00015 #include <netlink/netlink.h> 00016 00017 #ifdef __cplusplus 00018 extern "C" { 00019 #endif 00020 00021 struct nl_addr; 00022 00023 /* Creation */ 00024 extern struct nl_addr * nl_addr_alloc(size_t); 00025 extern struct nl_addr * nl_addr_build(int, void *, size_t); 00026 extern struct nl_addr * nl_addr_parse(const char *, int); 00027 extern struct nl_addr * nl_addr_clone(struct nl_addr *); 00028 00029 /* Destroyage */ 00030 extern void nl_addr_destroy(struct nl_addr *); 00031 00032 /* Usage Management */ 00033 extern struct nl_addr * nl_addr_get(struct nl_addr *); 00034 extern void nl_addr_put(struct nl_addr *); 00035 extern int nl_addr_shared(struct nl_addr *); 00036 00037 extern int nl_addr_cmp(struct nl_addr *, struct nl_addr *); 00038 extern int nl_addr_cmp_prefix(struct nl_addr *, struct nl_addr *); 00039 extern int nl_addr_iszero(struct nl_addr *); 00040 extern int nl_addr_valid(char *, int); 00041 extern int nl_addr_guess_family(struct nl_addr *); 00042 extern int nl_addr_fill_sockaddr(struct nl_addr *, 00043 struct sockaddr *, socklen_t *); 00044 extern struct addrinfo *nl_addr_info(struct nl_addr *addr); 00045 extern int nl_addr_resolve(struct nl_addr *addr, char *host, size_t hostlen); 00046 00047 /* Access Functions */ 00048 extern void nl_addr_set_family(struct nl_addr *, int); 00049 extern int nl_addr_get_family(struct nl_addr *); 00050 extern int nl_addr_set_binary_addr(struct nl_addr *, void *, 00051 size_t); 00052 extern void * nl_addr_get_binary_addr(struct nl_addr *); 00053 extern unsigned int nl_addr_get_len(struct nl_addr *); 00054 extern void nl_addr_set_prefixlen(struct nl_addr *, int); 00055 extern unsigned int nl_addr_get_prefixlen(struct nl_addr *); 00056 00057 /* Address Family Translations */ 00058 extern char * nl_af2str(int, char *, size_t); 00059 extern int nl_str2af(const char *); 00060 00061 /* Translations to Strings */ 00062 extern char * nl_addr2str(struct nl_addr *, char *, size_t); 00063 00064 #ifdef __cplusplus 00065 } 00066 #endif 00067 00068 #endif