|
|
@ -1,8 +1,34 @@ |
|
|
/* |
|
|
|
|
|
* some basic berkley socket stuff....far from beeing complete |
|
|
|
|
|
*/ |
|
|
|
|
|
#define USE_STRUCT_SCOT_SOCKET |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************** |
|
|
|
|
|
* |
|
|
|
|
|
* socket.c: some basic berkley socket stuff....far from beeing complete |
|
|
|
|
|
* |
|
|
|
|
|
* Copyright (C) 2009 Georg Steffers <georg@steffers.org> |
|
|
|
|
|
* This file is part of gameserver |
|
|
|
|
|
* |
|
|
|
|
|
* gameserver 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/>. |
|
|
|
|
|
* |
|
|
|
|
|
* Author: Georg Steffers (gst), georg@steffers.org |
|
|
|
|
|
* |
|
|
|
|
|
* Version: 0.0 |
|
|
|
|
|
* Created: 16.08.2009 19:59:33 |
|
|
|
|
|
* Revision: none |
|
|
|
|
|
* |
|
|
|
|
|
***************************************************************************/ |
|
|
|
|
|
|
|
|
|
|
|
#define USE_STRUCT_SCOT_SOCKET // set for include behaviour |
|
|
|
|
|
|
|
|
|
|
|
/* #### HEADER FILE INCLUDES ######################################### */ |
|
|
#include <string.h> |
|
|
#include <string.h> |
|
|
|
|
|
|
|
|
#include <scot/exception.h> |
|
|
#include <scot/exception.h> |
|
|
@ -16,12 +42,16 @@ |
|
|
|
|
|
|
|
|
#include <scot_common.h> |
|
|
#include <scot_common.h> |
|
|
|
|
|
|
|
|
|
|
|
/* #### MACROS - LOCAL TO THIS SOURCE FILE ######################### */ |
|
|
#define SCOT_SOCKET_NEW_FAIL 0 |
|
|
#define SCOT_SOCKET_NEW_FAIL 0 |
|
|
#define SCOT_SOCKET_LISTEN_FAIL 1 |
|
|
#define SCOT_SOCKET_LISTEN_FAIL 1 |
|
|
#define SCOT_SOCKET_ACCEPT_FAIL 2 |
|
|
#define SCOT_SOCKET_ACCEPT_FAIL 2 |
|
|
#define SCOT_SOCKET_CONNECT_FAIL 3 |
|
|
#define SCOT_SOCKET_CONNECT_FAIL 3 |
|
|
#define SCOT_SOCKET_NO_VALID_HOST 4 |
|
|
#define SCOT_SOCKET_NO_VALID_HOST 4 |
|
|
#define SCOT_SOCKET_AF_NOT_IMPLEMENTED 5 |
|
|
#define SCOT_SOCKET_AF_NOT_IMPLEMENTED 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* #### VARIABLES - LOCAL TO THIS SOURCE FILE ###################### */ |
|
|
const char * scot_socket_errmsg[] = |
|
|
const char * scot_socket_errmsg[] = |
|
|
{ |
|
|
{ |
|
|
"[SOCKET]failed to create new socket", |
|
|
"[SOCKET]failed to create new socket", |
|
|
@ -41,7 +71,7 @@ const char * scot_socket_wrnmsg[] = |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* #### FUNCTION DEFINITIONS - EXPORTED FUNCTIONS ################## */ |
|
|
void |
|
|
void |
|
|
scot_socket_init (uint16_t major, uint16_t minor) |
|
|
scot_socket_init (uint16_t major, uint16_t minor) |
|
|
{ |
|
|
{ |
|
|
|