1ZIFLIST(3) CZMQ Manual ZIFLIST(3)
2
3
4
6 ziflist - list of network interfaces available on system
7
9 // This is a stable class, and may not change except for emergencies. It
10 // is provided in stable builds.
11 // Get a list of network interfaces currently defined on the system
12 CZMQ_EXPORT ziflist_t *
13 ziflist_new (void);
14
15 // Destroy a ziflist instance
16 CZMQ_EXPORT void
17 ziflist_destroy (ziflist_t **self_p);
18
19 // Reload network interfaces from system
20 CZMQ_EXPORT void
21 ziflist_reload (ziflist_t *self);
22
23 // Return the number of network interfaces on system
24 CZMQ_EXPORT size_t
25 ziflist_size (ziflist_t *self);
26
27 // Get first network interface, return NULL if there are none
28 CZMQ_EXPORT const char *
29 ziflist_first (ziflist_t *self);
30
31 // Get next network interface, return NULL if we hit the last one
32 CZMQ_EXPORT const char *
33 ziflist_next (ziflist_t *self);
34
35 // Return the current interface IP address as a printable string
36 CZMQ_EXPORT const char *
37 ziflist_address (ziflist_t *self);
38
39 // Return the current interface broadcast address as a printable string
40 CZMQ_EXPORT const char *
41 ziflist_broadcast (ziflist_t *self);
42
43 // Return the current interface network mask as a printable string
44 CZMQ_EXPORT const char *
45 ziflist_netmask (ziflist_t *self);
46
47 // Return the list of interfaces.
48 CZMQ_EXPORT void
49 ziflist_print (ziflist_t *self);
50
51 // Self test of this class.
52 CZMQ_EXPORT void
53 ziflist_test (bool verbose);
54
55 Please add '@interface' section in './../src/ziflist.c'.
56
58 The ziflist class takes a snapshot of the network interfaces that the
59 system currently supports (this can change arbitrarily, especially on
60 mobile devices). The caller can then access the network interface
61 information using an iterator that works like zlistx. Only stores those
62 interfaces with broadcast capability, and ignores the loopback
63 interface.
64
65 Please add @discuss section in ./../src/ziflist.c.
66
68 From ziflist_test method.
69
70 ziflist_t *iflist = ziflist_new ();
71 assert (iflist);
72
73 size_t items = ziflist_size (iflist);
74
75 if (verbose) {
76 printf ("ziflist: interfaces=%zu\n", ziflist_size (iflist));
77 const char *name = ziflist_first (iflist);
78 while (name) {
79 printf (" - name=%s address=%s netmask=%s broadcast=%s\n",
80 name, ziflist_address (iflist), ziflist_netmask (iflist), ziflist_broadcast (iflist));
81 name = ziflist_next (iflist);
82 }
83 }
84 ziflist_reload (iflist);
85 assert (items == ziflist_size (iflist));
86 ziflist_destroy (&iflist);
87
88
90 The czmq manual was written by the authors in the AUTHORS file.
91
93 Main web site:
94
95 Report bugs to the email <zeromq-dev@lists.zeromq.org[1]>
96
98 Copyright (c) the Contributors as noted in the AUTHORS file. This file
99 is part of CZMQ, the high-level C binding for 0MQ:
100 http://czmq.zeromq.org. This Source Code Form is subject to the terms
101 of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
102 distributed with this file, You can obtain one at
103 http://mozilla.org/MPL/2.0/. LICENSE included with the czmq
104 distribution.
105
107 1. zeromq-dev@lists.zeromq.org
108 mailto:zeromq-dev@lists.zeromq.org
109
110
111
112CZMQ 4.0.2 12/31/2016 ZIFLIST(3)