su  1.12.11devel
su_localinfo.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Sofia-SIP package
3  *
4  * Copyright (C) 2005 Nokia Corporation.
5  *
6  * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation; either version 2.1 of
11  * the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21  * 02110-1301 USA
22  *
23  */
24 
25 #ifndef SU_LOCALINFO_H
27 #define SU_LOCALINFO_H
28 
29 
38 #ifndef SU_H
39 #include <sofia-sip/su.h>
40 #endif
41 
42 SOFIA_BEGIN_DECLS
43 
45 typedef struct su_localinfo_s su_localinfo_t;
46 
52  int li_flags;
53  int li_family;
54  int li_index;
55  int li_scope;
56  socklen_t li_addrlen;
58  char *li_canonname;
60  char *li_ifname;
61 };
62 
64 enum {
74  LI_DOWN = 16,
76  LI_IFNAME = 256
77 };
78 
80 enum {
81  LI_SCOPE_HOST = 0x10,
82  LI_SCOPE_LINK = 0x20,
83  LI_SCOPE_SITE = 0x40,
84  LI_SCOPE_GLOBAL = 0x80
85 };
86 
88 enum {
90  ELI_MEMORY = -2,
91  ELI_FAMILY = -3,
92  ELI_RESOLVER = -4,
93  ELI_SYSTEM = -5,
94  ELI_BADHINTS = -6,
95  ELI_NOERROR = 0
96 };
97 
100  su_localinfo_t **res);
104 SOFIAPUBFUN char const *su_gli_strerror(int error);
107 
109 SOFIAPUBFUN int su_sockaddr_scope(su_sockaddr_t const *su, socklen_t sulen);
110 
111 SOFIA_END_DECLS
112 
113 #endif /* !defined(SU_LOCALINFO_H) */
Local address info structure.
Definition: su_localinfo.h:48
char * li_ifname
Network interface name.
Definition: su_localinfo.h:60
socklen_t li_addrlen
Length of li_addr.
Definition: su_localinfo.h:56
int li_index
Network interface index.
Definition: su_localinfo.h:54
int li_family
Address family.
Definition: su_localinfo.h:53
int li_scope
Address scope.
Definition: su_localinfo.h:55
char * li_canonname
Canonical name for address.
Definition: su_localinfo.h:58
su_localinfo_t * li_next
Next structure in linked list.
Definition: su_localinfo.h:59
int li_flags
Bitwise or of flags: LI_V4MAPPED, LI_CANONNAME, LI_NAMEREQD, LI_NUMERIC, LI_DOWN, LI_IFNAME.
Definition: su_localinfo.h:52
su_sockaddr_t * li_addr
Binary address.
Definition: su_localinfo.h:57
Socket and network address interface.
#define SOFIAPUBFUN
SOFIAPUBFUN declares an exported function.
Definition: su_config.h:66
int su_sockaddr_scope(su_sockaddr_t const *su, socklen_t sulen)
Return the scope of address in the sockaddr structure.
Definition: su_localinfo.c:419
@ ELI_BADHINTS
Invalid value for hints.
Definition: su_localinfo.h:94
@ ELI_NOERROR
No error.
Definition: su_localinfo.h:95
@ ELI_RESOLVER
Error when resolving address.
Definition: su_localinfo.h:92
@ ELI_NOADDRESS
No matching address.
Definition: su_localinfo.h:89
@ ELI_SYSTEM
System error.
Definition: su_localinfo.h:93
@ ELI_MEMORY
Memory allocation error.
Definition: su_localinfo.h:90
@ ELI_FAMILY
Unknown address family.
Definition: su_localinfo.h:91
char const * su_gli_strerror(int error)
Describe su_localinfo errors.
Definition: su_localinfo.c:307
su_localinfo_t * su_copylocalinfo(su_localinfo_t const *li0)
Copy a localinfo structure.
Definition: su_localinfo.c:323
@ LI_NUMERIC
Instead of domain name, use numeric form.
Definition: su_localinfo.h:72
@ LI_NAMEREQD
Do not return addresses not in DNS.
Definition: su_localinfo.h:70
@ LI_IFNAME
Get interface name.
Definition: su_localinfo.h:76
@ LI_DOWN
Include interfaces even if they are down (new in 1.12.2).
Definition: su_localinfo.h:74
@ LI_CANONNAME
Get domain name corresponding to the local address.
Definition: su_localinfo.h:68
@ LI_V4MAPPED
IPv4 addresses will be mapped as IPv6.
Definition: su_localinfo.h:66
@ LI_SCOPE_SITE
Site-local address.
Definition: su_localinfo.h:83
@ LI_SCOPE_HOST
Host-local address, valid within host.
Definition: su_localinfo.h:81
@ LI_SCOPE_LINK
Link-local address.
Definition: su_localinfo.h:82
@ LI_SCOPE_GLOBAL
Global address.
Definition: su_localinfo.h:84
void su_freelocalinfo(su_localinfo_t *)
Free local address information.
Definition: su_localinfo.c:284
int su_getlocalinfo(su_localinfo_t const *hints, su_localinfo_t **res)
Request local address information.
Definition: su_localinfo.c:194
Common socket address structure.
Definition: su.h:157

Sofia-SIP 1.12.11devel - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.