2005-03-19 23:16:49 +01:00
|
|
|
/* -*-mode: C; fill-column: 78; c-basic-offset: 4; -*- */
|
|
|
|
|
2012-01-05 03:14:12 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2005 - 2012 by Eric House (xwords@eehouse.org). All rights
|
|
|
|
* reserved.
|
|
|
|
*
|
|
|
|
* 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 2
|
|
|
|
* 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, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2005-03-19 23:16:49 +01:00
|
|
|
#ifndef _XWRELAY_PRIV_H_
|
|
|
|
#define _XWRELAY_PRIV_H_
|
|
|
|
|
2005-07-05 23:57:00 +02:00
|
|
|
#include <time.h>
|
2012-01-05 03:14:12 +01:00
|
|
|
#include <netinet/in.h>
|
2007-12-01 16:00:30 +01:00
|
|
|
#include "lstnrmgr.h"
|
2009-08-21 14:00:09 +02:00
|
|
|
#include "xwrelay.h"
|
2005-07-05 23:57:00 +02:00
|
|
|
|
2009-02-28 17:15:59 +01:00
|
|
|
typedef unsigned char HostID; /* see HOST_ID_SERVER */
|
2005-03-19 23:16:49 +01:00
|
|
|
|
2005-10-02 18:08:42 +02:00
|
|
|
typedef enum {
|
2005-10-30 06:10:26 +01:00
|
|
|
XW_LOGERROR
|
|
|
|
,XW_LOGINFO
|
|
|
|
,XW_LOGVERBOSE0
|
|
|
|
,XW_LOGVERBOSE1
|
2005-10-02 18:08:42 +02:00
|
|
|
} XW_LogLevel;
|
|
|
|
|
|
|
|
void logf( XW_LogLevel level, const char* format, ... );
|
2005-03-19 23:16:49 +01:00
|
|
|
|
2009-12-04 09:03:27 +01:00
|
|
|
void denyConnection( int socket, XWREASON err );
|
2008-12-30 06:13:30 +01:00
|
|
|
bool send_with_length_unsafe( int socket, unsigned char* buf, int bufLen );
|
2005-07-06 03:36:52 +02:00
|
|
|
|
2009-03-10 13:52:17 +01:00
|
|
|
time_t uptime(void);
|
2005-06-23 06:26:44 +02:00
|
|
|
|
2010-10-05 05:03:00 +02:00
|
|
|
void blockSignals( void ); /* call from all but main thread */
|
|
|
|
|
2009-07-29 06:25:21 +02:00
|
|
|
int GetNSpawns(void);
|
|
|
|
|
2007-12-01 16:00:30 +01:00
|
|
|
int make_socket( unsigned long addr, unsigned short port );
|
|
|
|
|
2010-09-21 15:38:43 +02:00
|
|
|
int read_packet( int sock, unsigned char* buf, int buflen );
|
2012-01-05 03:14:12 +01:00
|
|
|
void handle_proxy_packet( unsigned char* buf, int bufLen, int socket,
|
|
|
|
in_addr& addr );
|
2010-09-21 15:38:43 +02:00
|
|
|
|
2009-08-21 14:00:09 +02:00
|
|
|
const char* cmdToStr( XWRELAY_Cmd cmd );
|
|
|
|
|
2007-12-01 16:00:30 +01:00
|
|
|
extern class ListenerMgr g_listeners;
|
|
|
|
|
2005-03-19 23:16:49 +01:00
|
|
|
#endif
|