libsysactivity  0.6.3
 All Data Structures Functions Variables Enumerations Enumerator Groups Pages
network.h
1 /*
2  * libsysactivity
3  * http://sourceforge.net/projects/libsysactivity/
4  * Copyright (c) 2009, 2010 Carlos Olmedo Escobar <carlos.olmedo.e@gmail.com>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
25 #ifndef SA_NET_H_
26 #define SA_NET_H_
27 
31 SA_EXPORT struct sa_net_interface {
32 #ifdef SA_NET_INTERFACE_NAME
33  char name[SA_NET_INTERFACE_NAME];
34 #endif
35 #ifdef SA_NET_INTERFACE_RECEIVED_BYTES
36  uint64_t received_bytes;
37 #endif
38 #ifdef SA_NET_INTERFACE_RECEIVED_PACKETS
39  uint64_t received_packets;
40 #endif
41 #ifdef SA_NET_INTERFACE_RECEIVED_ERRORS
42  uint64_t received_errors;
43 #endif
44 #ifdef SA_NET_INTERFACE_RECEIVED_DROP
45  uint64_t received_drop;
46 #endif
47 #ifdef SA_NET_INTERFACE_RECEIVED_FIFO
48  uint64_t received_fifo;
49 #endif
50 #ifdef SA_NET_INTERFACE_RECEIVED_COMPRESSED
52 #endif
53 #ifdef SA_NET_INTERFACE_RECEIVED_MULTICAST
54  uint64_t received_multicast;
55 #endif
56 #ifdef SA_NET_INTERFACE_SENT_BYTES
57  uint64_t sent_bytes;
58 #endif
59 #ifdef SA_NET_INTERFACE_SENT_PACKETS
60  uint64_t sent_packets;
61 #endif
62 #ifdef SA_NET_INTERFACE_SENT_ERRORS
63  uint64_t sent_errors;
64 #endif
65 #ifdef SA_NET_INTERFACE_SENT_DROP
66  uint64_t sent_drop;
67 #endif
68 #ifdef SA_NET_INTERFACE_SENT_FIFO
69  uint64_t sent_fifo;
70 #endif
71 #ifdef SA_NET_INTERFACE_SENT_COMPRESSED
72  uint64_t sent_compressed;
73 #endif
74 #ifdef SA_NET_INTERFACE_SENT_MULTICAST
75  uint64_t sent_multicast;
76 #endif
77 };
78 
79 #ifdef SA_OPEN_NET
80 
86 int sa_open_net(void) SA_EXPORT;
87 #endif
88 
89 #ifdef SA_CLOSE_NET
90 
96 int sa_close_net(void) SA_EXPORT;
97 #endif
98 
106 int sa_count_net_interfaces(uint16_t* number) SA_EXPORT SA_NONNULL;
107 
113 int sa_reset_net_interfaces() SA_EXPORT;
114 
124 int sa_get_net_interfaces_ids(char* dst, uint16_t dst_size, uint16_t* written) SA_EXPORT SA_NONNULL;
125 
134 int sa_get_net_interface(char* name, struct sa_net_interface* dst) SA_EXPORT SA_NONNULL;
135 
145 int sa_get_net_interfaces(struct sa_net_interface* dst, uint16_t dst_size, uint16_t* written) SA_EXPORT SA_NONNULL;
146 
148 #endif /* SA_NET_H_ */