nexmon – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 /* inet_addr.c
2 *
3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 */
21  
22 #include "config.h"
23  
24 #include "inet_addr.h"
25  
26 #include "inet_addr-int.h"
27  
28 static inline gboolean
29 _inet_pton(int af, const gchar *src, gpointer dst)
30 {
31 gint ret;
32  
33 ret = inet_pton(af, src, dst);
34 g_assert(ret >= 0);
35 return ret == 1;
36 }
37  
38 const gchar *
39 ws_inet_ntop4(gconstpointer src, gchar *dst, guint dst_size)
40 {
41 return inet_ntop(AF_INET, src, dst, dst_size);
42 }
43  
44 gboolean
45 ws_inet_pton4(const gchar *src, guint32 *dst)
46 {
47 return _inet_pton(AF_INET, src, dst);
48 }
49  
50 const gchar *
51 ws_inet_ntop6(gconstpointer src, gchar *dst, guint dst_size)
52 {
53 return inet_ntop(AF_INET6, src, dst, dst_size);
54 }
55  
56 gboolean
57 ws_inet_pton6(const gchar *src, struct e_in6_addr *dst)
58 {
59 return _inet_pton(AF_INET6, src, dst);
60 }