NetLink Sockets C++
1.0.0
Networking C++ Library
Main Page
Namespaces
Classes
Files
Examples
File List
All
Classes
Namespaces
Files
Functions
Enumerations
Enumerator
Pages
include
netlink
core.h
Go to the documentation of this file.
1
/*
2
NetLink Sockets: Networking C++ library
3
Copyright 2012 Pedro Francisco Pareja Ruiz (PedroPareja@Gmail.com)
4
5
This file is part of NetLink Sockets.
6
7
NetLink Sockets is free software: you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation, either version 3 of the License, or
10
(at your option) any later version.
11
12
NetLink Sockets 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 NetLink Sockets. If not, see <http://www.gnu.org/licenses/>.
19
20
*/
21
28
#ifndef __NL_CORE
29
#define __NL_CORE
30
31
#include "netlink/config.h"
32
33
#define NL_NAMESPACE_NAME NL
34
35
#define NL_NAMESPACE namespace NL_NAMESPACE_NAME {
36
#define NL_NAMESPACE_END };
37
#define NL_NAMESPACE_USE using namespace NL_NAMESPACE_NAME;
38
39
40
#if defined(_WIN32) || defined(__WIN32__) || defined(_MSC_VER)
41
42
#define OS_WIN32
43
#define _WIN32_WINNT 0x501
44
45
46
#include <winsock2.h>
47
#include <ws2tcpip.h>
48
49
// Requires Win7 or Vista
50
// Link to Ws2_32.lib library
51
52
53
#define snprintf _snprintf
54
55
#else
56
57
#define OS_LINUX
58
59
#include <arpa/inet.h>
60
#include <sys/fcntl.h>
61
#include <sys/types.h>
62
#include <sys/socket.h>
63
#include <sys/unistd.h>
64
#include <sys/time.h>
65
#include <netdb.h>
66
#include <sys/ioctl.h>
67
#include <errno.h>
68
69
#endif
70
71
72
#include <string>
73
74
75
NL_NAMESPACE
76
77
using
std::string;
78
79
80
void
init
();
81
82
89
enum
Protocol
{
90
91
TCP
,
92
UDP
93
};
94
95
102
enum
IPVer
{
103
104
IP4
,
105
IP6
,
106
ANY
107
};
108
109
116
enum
SocketType
{
117
118
CLIENT
,
119
SERVER
120
};
121
122
NL_NAMESPACE_END
123
124
125
#include "netlink/exception.h"
126
#include "netlink/release_manager.h"
127
#include "netlink/util.h"
128
129
#endif
Generated on Fri Mar 7 2014 16:23:05 for NetLink Sockets C++ by
1.8.3.1