2011-09-30 15:32:21 +02:00
|
|
|
/* -*- compile-command: "make MEMDEBUG=TRUE -j3"; -*- */
|
2003-11-01 06:35:29 +01:00
|
|
|
/*
|
2011-09-30 15:32:21 +02:00
|
|
|
* Copyright 1997-2011 by Eric House (xwords@eehouse.org). All rights
|
|
|
|
* reserved.
|
2003-11-01 06:35:29 +01:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
#ifndef _LINUXMAIN_H_
|
|
|
|
#define _LINUXMAIN_H_
|
|
|
|
|
|
|
|
#include "main.h"
|
|
|
|
#include "dictnry.h"
|
|
|
|
#include "mempool.h"
|
|
|
|
#include "comms.h"
|
|
|
|
#include "memstream.h"
|
|
|
|
/* #include "compipe.h" */
|
|
|
|
|
|
|
|
extern int errno;
|
|
|
|
|
|
|
|
typedef struct LinuxBMStruct {
|
|
|
|
XP_U8 nCols;
|
|
|
|
XP_U8 nRows;
|
|
|
|
XP_U8 nBytes;
|
|
|
|
} LinuxBMStruct;
|
|
|
|
|
|
|
|
int initListenerSocket( int port );
|
2006-08-26 23:15:20 +02:00
|
|
|
XP_S16 linux_send( const XP_U8* buf, XP_U16 buflen,
|
2014-10-15 16:26:18 +02:00
|
|
|
const CommsAddrRec* addrRec, CommsConnType conType,
|
2012-01-26 03:27:37 +01:00
|
|
|
XP_U32 gameID, void* closure );
|
2008-01-19 17:03:53 +01:00
|
|
|
#ifndef XWFEATURE_STANDALONE_ONLY
|
|
|
|
# define LINUX_SEND linux_send
|
|
|
|
#else
|
|
|
|
# define LINUX_SEND NULL
|
|
|
|
#endif
|
|
|
|
|
2007-11-19 00:43:27 +01:00
|
|
|
#ifdef COMMS_HEARTBEAT
|
|
|
|
void linux_reset( void* closure );
|
|
|
|
#endif
|
2014-11-11 16:36:55 +01:00
|
|
|
int linux_relay_receive( CommonGlobals* cGlobals, int sock,
|
|
|
|
unsigned char* buf, int bufSize );
|
2005-03-12 06:33:30 +01:00
|
|
|
|
2010-01-25 01:28:30 +01:00
|
|
|
XP_Bool linuxFireTimer( CommonGlobals* cGlobals, XWTimerReason why );
|
2005-09-09 05:12:58 +02:00
|
|
|
|
|
|
|
|
2006-08-16 15:44:44 +02:00
|
|
|
XWStreamCtxt* stream_from_msgbuf( CommonGlobals* cGlobals,
|
2013-01-23 16:43:58 +01:00
|
|
|
const unsigned char* bufPtr, XP_U16 nBytes );
|
2003-11-01 06:35:29 +01:00
|
|
|
XP_UCHAR* strFromStream( XWStreamCtxt* stream );
|
|
|
|
|
|
|
|
void catGameHistory( CommonGlobals* cGlobals );
|
|
|
|
void catOnClose( XWStreamCtxt* stream, void* closure );
|
2012-11-13 16:23:07 +01:00
|
|
|
void sendOnClose( XWStreamCtxt* stream, void* closure );
|
|
|
|
|
2012-10-09 14:31:12 +02:00
|
|
|
void catFinalScores( const CommonGlobals* cGlobals, XP_S16 quitter );
|
2008-09-18 05:46:27 +02:00
|
|
|
XP_Bool file_exists( const char* fileName );
|
|
|
|
XWStreamCtxt* streamFromFile( CommonGlobals* cGlobals, char* name,
|
|
|
|
void* closure );
|
2012-07-27 05:44:33 +02:00
|
|
|
XWStreamCtxt* streamFromDB( CommonGlobals* cGlobals, void* closure );
|
2008-09-18 05:46:27 +02:00
|
|
|
void writeToFile( XWStreamCtxt* stream, void* closure );
|
2012-09-04 06:33:46 +02:00
|
|
|
XP_Bool getDictPath( const LaunchParams *params, const char* name,
|
|
|
|
char* result, int resultLen );
|
2012-10-24 04:06:00 +02:00
|
|
|
GSList* listDicts( const LaunchParams *params );
|
2012-09-10 16:31:45 +02:00
|
|
|
void saveGame( CommonGlobals* cGlobals );
|
2008-09-18 05:46:27 +02:00
|
|
|
|
2009-02-28 20:19:42 +01:00
|
|
|
void linux_close_socket( CommonGlobals* cGlobals );
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2007-01-06 18:46:02 +01:00
|
|
|
#ifdef KEYBOARD_NAV
|
|
|
|
XP_Bool linShiftFocus( CommonGlobals* cGlobals, XP_Key key,
|
|
|
|
const BoardObjectType* order,
|
|
|
|
BoardObjectType* nxtP );
|
|
|
|
#endif
|
|
|
|
|
2011-09-30 15:32:21 +02:00
|
|
|
void read_pipe_then_close( CommonGlobals* cGlobals,
|
|
|
|
const TransportProcs* procs );
|
|
|
|
void do_nbs_then_close( CommonGlobals* cGlobals,
|
|
|
|
const TransportProcs* procs );
|
2011-01-25 07:20:47 +01:00
|
|
|
|
2012-05-24 04:58:03 +02:00
|
|
|
#ifdef USE_GLIBLOOP
|
|
|
|
void setOneSecondTimer( CommonGlobals* cGlobals );
|
|
|
|
#else
|
|
|
|
# define setOneSecondTimer( cGlobals )
|
|
|
|
#endif
|
|
|
|
|
2013-01-07 15:10:44 +01:00
|
|
|
void setupLinuxUtilCallbacks( XW_UtilCtxt* util );
|
2013-01-08 05:40:46 +01:00
|
|
|
void initFromParams( CommonGlobals* cGlobals, LaunchParams* params );
|
|
|
|
void setupUtil( CommonGlobals* cGlobals );
|
|
|
|
|
|
|
|
DictionaryCtxt* makeDictForStream( CommonGlobals* cGlobals,
|
|
|
|
XWStreamCtxt* stream );
|
2013-01-08 16:28:30 +01:00
|
|
|
void linuxSetIsServer( CommonGlobals* cGlobals, XP_Bool isServer );
|
|
|
|
void linuxChangeRoles( CommonGlobals* cGlobals );
|
2013-01-07 15:10:44 +01:00
|
|
|
|
2013-01-24 16:49:49 +01:00
|
|
|
void sendRelayReg( LaunchParams* params, sqlite3* pDb );
|
|
|
|
void gameGotBuf( CommonGlobals* globals, XP_Bool haveDraw,
|
2013-12-16 17:06:29 +01:00
|
|
|
const XP_U8* buf, XP_U16 len, const CommsAddrRec* from );
|
2013-01-24 16:49:49 +01:00
|
|
|
gboolean app_socket_proc( GIOChannel* source, GIOCondition condition,
|
|
|
|
gpointer data );
|
2013-01-29 16:42:10 +01:00
|
|
|
const XP_UCHAR* linux_getDevID( LaunchParams* params, DevIDType* typ );
|
2013-09-15 06:06:14 +02:00
|
|
|
void linux_doInitialReg( LaunchParams* params, XP_Bool idIsNew );
|
|
|
|
XP_Bool linux_setupDevidParams( LaunchParams* params );
|
2013-01-24 16:49:49 +01:00
|
|
|
|
2013-01-06 01:08:47 +01:00
|
|
|
/* void initParams( LaunchParams* params ); */
|
|
|
|
/* void freeParams( LaunchParams* params ); */
|
2013-01-06 01:08:19 +01:00
|
|
|
|
2003-11-01 06:35:29 +01:00
|
|
|
#endif
|