blob: b98723fa441f27a6bb1428ef88e59cf99b346112 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
/*
Copyright (C) 2008 Andreas Baumann <abaumann@yahoo.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef WOLF_NETWORK_H
#define WOLF_NETWORK_H
/**
* @addtogroup wolf_networking support for networking
* @{
*/
/**
* @file network.h
* @brief Portable helper functions for networking
* @author Andreas Baumann <abaumann@yahoo.com>
*/
#ifdef __cplusplus
extern "C" {
#endif
#include "port/sys.h"
/**
* helper union to avoid anti-aliasing warnings in old network functions like getpeername,
* use instead of struct sockaddr_storage when declaring socket address variables which need
* proper alignment
*/
typedef union wolf_network_sockaddr_union_t {
struct sockaddr_storage storage;
struct sockaddr_in in;
#ifdef HAVE_IPV6
struct sockaddr_in6 in6;
#endif
struct sockaddr addr;
} wolf_network_sockaddr_union_t;
#ifdef __cplusplus
}
#endif
/** @} */ /* @addtogroup wolf_networking */
#endif /* ifndef WOLF_NETWORK_H */
|