NetLink Sockets C++ 1.0.0
Networking C++ Library @ Get NetLink Sockets C++ Library at SourceForge.net. Fast, secure and Free Open Source software downloads

include/netlink/core.h

Go to the documentation of this file.
00001 /*
00002     NetLink Sockets: Networking C++ library
00003     Copyright 2012 Pedro Francisco Pareja Ruiz (PedroPareja@Gmail.com)
00004 
00005     This file is part of NetLink Sockets.
00006 
00007     NetLink Sockets is free software: you can redistribute it and/or modify
00008     it under the terms of the GNU General Public License as published by
00009     the Free Software Foundation, either version 3 of the License, or
00010     (at your option) any later version.
00011 
00012     NetLink Sockets is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015     GNU General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with NetLink Sockets. If not, see <http://www.gnu.org/licenses/>.
00019 
00020 */
00021 
00028 #ifndef __NL_CORE
00029 #define __NL_CORE
00030 
00031 #include "netlink/config.h"
00032 
00033 #define NL_NAMESPACE_NAME NL
00034 
00035 #define NL_NAMESPACE namespace NL_NAMESPACE_NAME {
00036 #define NL_NAMESPACE_END };
00037 #define NL_NAMESPACE_USE using namespace NL_NAMESPACE_NAME;
00038 
00039 
00040 #if defined(_WIN32) || defined(__WIN32__) || defined(_MSC_VER)
00041 
00042     #define OS_WIN32
00043     //#define _WIN32_WINNT 0x0600
00044 
00045 
00046     #include <winsock2.h>
00047     #include <ws2tcpip.h>
00048 
00049     // Requires Win7 or Vista
00050     // Link to Ws2_32.lib library
00051 
00052 
00053         #define snprintf _snprintf
00054 
00055 #else
00056 
00057     #define OS_LINUX
00058 
00059     #include <arpa/inet.h>
00060     #include <sys/fcntl.h>
00061     #include <sys/types.h>
00062     #include <sys/socket.h>
00063     #include <sys/unistd.h>
00064     #include <sys/time.h>
00065     #include <netdb.h>
00066     #include <sys/ioctl.h>
00067     #include <errno.h>
00068 
00069 #endif
00070 
00071 #include <string>
00072 
00073 
00074 NL_NAMESPACE
00075 
00076 using std::string;
00077 
00078 
00079 void init();
00080 
00081 
00088 enum Protocol {
00089 
00090     TCP,
00091     UDP
00092 };
00093 
00094 
00101 enum IPVer {
00102 
00103     IP4,
00104     IP6,
00105     ANY
00106 };
00107 
00108 
00115 enum SocketType {
00116 
00117     CLIENT,     
00118     SERVER      
00119 };
00120 
00121 NL_NAMESPACE_END
00122 
00123 
00124 #include "netlink/exception.h"
00125 #include "netlink/release_manager.h"
00126 #include "netlink/util.h"
00127 
00128 #endif
 All Classes Namespaces Files Functions Enumerations Enumerator