#ifndef SWSERV_H #define SWSERV_H #include #include "../include/cs.h" #include "../include/reality.h" #include "../include/objects.h" /* * Program Name & Version: */ #define PROG_NAME_FULL "ShipWars Server" #define PROG_NAME "SWServ" #define PROG_VERSION "2.5.5" #define PROG_VERSION_MAJOR 2 #define PROG_VERSION_MINOR 5 #define PROG_VERSION_RELEASE 5 /* * Usage: */ #define PROG_USAGE_MESSAGE "\ Usage: swserv [options]\n\ \n\ should exist, if it is not specified then the\n\ program will attempt to load swserv.conf from the current\n\ directory.\n\ \n\ [options] can be any of the following:\n\ \n\ -unvin Universe file to read from.\n\ -unvout Universe file to write to.\n\ -opm Object parameter macros file.\n\ -ocs Object create scripts file.\n\ -p Port number.\n\ -q Run in `quiet mode'.\n\ --foreground Run in foreground, do not fork into\n\ background.\n\ --help Print (this) help screen and exit.\n\ --version Print version information.\n\ \n\ Note: Command line options override any options specified in the\n\ .\n\ \n" /* * Copyright information: */ #define PROG_COPYRIGHT "\ Copyright (C) 1997-2006 WolfPack Entertainment.\n\ This program is protected by international copyright laws and treaties,\n\ distribution and/or modification of this software in violation of the\n\ GNU Public License is strictly prohibited. Violators will be prosecuted\n\ to the fullest extent of the law." /* * Debug message footer: */ #define SWS_DEBUG_FOOTER "\ \n\ *** If you received this message unexpectedly and/or the program has\n\ *** crashed, please e-mail the entire above debug message and steps\n\ *** that you can recall which resulted in this to the addresses listed:\n\ *** at http://wolfpack.twu.net/contacts.html\n\ ***************************************************************************\n" /* * Default Directories: */ #if defined(__WIN32__) # define SWS_TOPLEVEL_DIR "." # define SWS_BIN_DIR "." # define SWS_DB_DIR "db" # define SWS_ETC_DIR "." # define SWS_LOGS_DIR "logs" # define SWS_PLUGINS_DIR "plugins" # define SWS_PUBLIC_HTML_DIR "public_html" # define SWS_TMP_DIR "tmp" # define ETC_DIR "." #else # define SWS_TOPLEVEL_DIR "/home/swserv" # define SWS_BIN_DIR "/home/swserv/bin" # define SWS_DB_DIR "/home/swserv/db" # define SWS_ETC_DIR "/home/swserv/etc" # define SWS_LOGS_DIR "/home/swserv/logs" # define SWS_PLUGINS_DIR "/home/swserv/plugins" # define SWS_PUBLIC_HTML_DIR "/home/swserv/public_html" # define SWS_TMP_DIR "/home/swserv/tmp" # define ETC_DIR "/etc" #endif /* * Default Incoming Connections Port: */ #define SWS_DEF_PORT 1701 /* * Default Maximum Connections: */ #define SWS_DEF_MAX_CONNECTIONS 100 /* * Default Maximum Guests: */ #define SWS_DEF_MAX_GUESTS 10 /* * Default Maximum AUX Stats Connections: */ #define SWS_DEF_MAX_AUX_STATS_CONNECTIONS 100 /* * Default Login Timeout: * * If a socket is connected but has not logged in within this * many seconds then the socket will be disconnected. */ #define SWS_DEF_LOGIN_TIMEOUT 60 /* * Default Maximum Failed Logins: * * If a socket is connected but has not logged in and sent more * than this many incorrect logins then the socket will be * disconnected. */ #define SWS_DEF_MAX_FAILED_LOGINS 5 /* * Objects Allocate Ahead: * * Objects are allocated ahead in this many chunks. */ #define SWS_OBJECT_ALLOCATE_AHEAD 10 /* * Maximum Object Parameter Models: * * Maximum OPMs that can be allocated in memory. */ #define SWS_MAX_OPMS 10000 /* * Maximum Object Create Scripts: * * Maximum OCSs that can be allocated in memory. */ #define SWS_MAX_OCSS 500 #define SWS_MAX_OCS_COPPIES 64 /* Max coppies per ocs */ /* * Default Object Update Send Interval (in ms): * * Min and max intervals to update objects to a connection. */ #define SWS_MIN_OBJECT_UPDATE_INT 25 #define SWS_MAX_OBJECT_UPDATE_INT 5000 #define SWS_DEF_OBJECT_UPDATE_INT 1000 /* * Maximum Buffers Per Connection: */ #define SWS_MAX_CON_BUF_ITEMS 1000 /* * Host Name Length: */ #define SWS_HOST_NAME_MAX 256 /* * Default Wrong Login Message: */ #define SWS_DEF_WRONG_LOGIN_MESG \ "Either that player does not exist, or has a different password." /* * Default No Guests Message: */ #define SWS_DEF_NO_GUESTS_MESG \ "%name connections are not permitted in %title." /* * Default Welcome Message: * * %title is replaced with the universe's name and %name is * replaced by the object. */ #define SWS_DEF_WELCOME_MESG \ "Welcome to %title, %name." /* * Default Leave Message: * * %title is replaced with the universe's name and %name is replaced * by the object if available. */ #define SWS_DEF_LEAVE_MESG \ "Disconnected from %title." /* * Configuration File: * * This is the very first file that SWServ looks for and it must * be found or else SWServ will not run. * * It will searched for in the following places: * * * Location specified from command line * * Current working directory * * SWS_ETC_DIR directory * * ETC_DIR global directory * * If this file is not found, swserv will not run. */ #define SWS_CFG_FILE "swserv.conf" /* * Default Log File: * * This file is placed in the SWS_LOGS_DIR directory.. */ #define SWS_DEF_LOG_FILE "swserv.log" /* * Default PID File: * * This file is placed in the SWS_TMP_DIR directory. */ #define SWS_DEF_PID_FILE "swserv.pid" /* * Default Universe Files: * * These are the default database filenames names when none is * specified from the command line. You should, however, always * specify a database file from the command line or in the * SWS_RC_FILE file. */ #define SWS_DEF_UNV_IN_FILE "generic_in.unv" #define SWS_DEF_UNV_OUT_FILE "generic_out.unv" /* * Default Object Parameter Models File: * * This is the default Object Parameters Macro file. You should, * however, always specify a file from the command line or in the * SWS_RC_FILE file. */ #define SWS_DEF_OPM_FILE "default.opm" /* * Default Object Create Scripts File: * * This is the default Object Create Scripts file. You should, * however, always specify a file from the command line or in the * SWS_RC_FILE file. */ #define SWS_DEF_OCS_FILE "default.ocs" /* * SWServ Proprietery SW Object Flags: * * Set in member ext_flags of each SW Object. */ /* Indicates that this is a player object that is connected */ #define SWS_OBJ_FLAG_CONNECTED (1 << 1) /* Do not report the existance of this object to any connection, this * is used to hide players when they are disconnected */ #define SWS_OBJ_FLAG_HIDEFROMCON (1 << 2) /* Specifies that this weapon object can penetrate shields */ #define SWS_OBJ_FLAG_WEP_PENETRATE_SHIELD (1 << 3) /* Specifies that this weapon object can be destroyed by other weapons */ #define SWS_OBJ_FLAG_WEP_DESTROYABLE (1 << 4) /* Specifies that this weapon object produces a shockwave whenever it * hits anything */ #define SWS_OBJ_FLAG_WEP_SHOCKWAVE_HIT (1 << 5) /* Indicates that the object is or is in the process of being destroyed */ #define SWS_OBJ_FLAG_DESTROYED (1 << 7) /* Indicates that the object is on fire */ #define SWS_OBJ_FLAG_ON_FIRE (1 << 8) /* Indicates that the object is producing a smoke trail */ #define SWS_OBJ_FLAG_SMOKE_TRAIL (1 << 9) /* * Permission Access Levels: * * Minimum permission level to access/perform the respective * function, permissoin levels less or equal will be granted access * (permission level 0 is always unrestricted). * * The highest level is 0 and the lowest is 5. */ #define SWS_ACCESS_UID_BOOT 1 #define SWS_ACCESS_UID_CREATE 3 #define SWS_ACCESS_UID_CREATEPLAYER 1 #define SWS_ACCESS_UID_CHOWN 4 #define SWS_ACCESS_UID_CHOWNO 3 #define SWS_ACCESS_UID_DISK 5 #define SWS_ACCESS_UID_EXAMINE 5 #define SWS_ACCESS_UID_EXAMINEO 3 #define SWS_ACCESS_UID_FIND 5 #define SWS_ACCESS_UID_FINDO 3 #define SWS_ACCESS_UID_MEM 5 /* Get mem statistics */ #define SWS_ACCESS_UID_MEMOP 1 /* Reload/reclaim/refresh stuff */ #define SWS_ACCESS_UID_MEMRELOADUNV 0 /* Reload universe input file */ #define SWS_ACCESS_UID_NETSTAT 5 /* View net stats */ #define SWS_ACCESS_UID_PLUGINVIEW 5 /* View loaded plugins */ #define SWS_ACCESS_UID_PLUGINOP 1 /* Load/unload plugins */ #define SWS_ACCESS_UID_RECOVER 5 #define SWS_ACCESS_UID_RECOVERO 3 #define SWS_ACCESS_UID_RECYCLE 3 /* Recycle own's objects */ #define SWS_ACCESS_UID_RECYCLEO 1 /* Recycle other's objects */ #define SWS_ACCESS_UID_RECYCLEPLAYER 1 #define SWS_ACCESS_UID_SAVE 1 /* Save the universe */ #define SWS_ACCESS_UID_SET 3 /* Set own object parameter values */ #define SWS_ACCESS_UID_SETO 1 /* Set other's object parameter values */ #define SWS_ACCESS_UID_SHUTDOWN 0 #define SWS_ACCESS_UID_SIGNUP 5 #define SWS_ACCESS_UID_SITEBAN 1 #define SWS_ACCESS_UID_SYNCTIME 3 #define SWS_ACCESS_UID_SYSPARM 1 /* Set or view sysparms */ #define SWS_ACCESS_UID_UPTIME 5 /* * Weapon and Destroy Immune Access Level: * * Objects with a equal or higher UID than SWS_ACCESS_UID_WEAPON_IMMUNE * will not be damaged by weapons fire. * Objects with a equal or higher UID than SWS_ACCESS_UID_DESTROY_IMMUNE * will not be destroyed when their hitpoints (hp) reaches 0. */ #define SWS_ACCESS_UID_WEAPON_IMMUNE 1 #define SWS_ACCESS_UID_DESTROY_IMMUNE 1 /* * Default Movement Limiting Tolorance: * * Specifies the tolorance in the limiting of movements that exceed * the object's maximum velocity that are received from the client. * * 1.0 is no tolorance, 2.0 is double the tolorance. */ #define SWS_DEF_MOVEMENT_LIMIT_TOLORANCE 2.0 /* * Default On Fire HP Coeff: * * Specifies the coefficient of when a controlled or player object * is on fire when its hp coefficient drops below this value. * * 0.0 to 1.0 */ #define SWS_DEF_ON_FIRE_HP_COEFF 0.35 /* * Default Hit Player Bonus: * * Owner of weapon that hit a player object gets this much coeff * of credits per unit damage given. For instance, 0.25 would give * 25 credits if there was 100 units of inflicted damage. */ #define SWS_DEF_HIT_PLAYER_BONUS 0.25 /* * Default Asteroid Field Damage Rate: * * hp -= size_ru * obj_velocity / af_velocity_max * * asteroid_field_damage_rate * * Where size_ru is the size of the vessel in real units, * obj_velocity is the current speed of the object, and * af_velocity_max is the defined speed threshold of damage of * the asteroid field. * * Damage only takes place while obj_velocity >= af_velocity_max. */ #define SWS_DEF_ASTEROID_FIELD_DAMAGE_RATE 0.001 /* * Default Cloak Antimatter Consumption Rate: * * antimatter -= size_ru * cloak_am_rate */ #define SWS_DEF_CLOAK_AM_RATE 0.2 /* * Default Damage Control Rate: * * Coefficient used in determining how fast damage is repaired * on a vessel with damage control turned on. * * Equation is: hp_inc_per_cycle = dmg_ctl_rate * power * * power_purity */ #define SWS_DEF_DMG_CTL_RATE 0.00003 /* * Default Engine Antimatter Rate: * * antimatter -= engine_antimatter_rate * throttle */ #define SWS_DEF_ENGINE_ANTIMATTER_RATE 0.001 /* * Default Tractor Beam Antimatter Consumption Rate: * * In size_ru * antimatter / cycle. * * Where size_ru is the size of the tractored object in real units. */ #define SWS_DEF_TRACTOR_BEAM_AM_RATE 0.3 /* * Default Transporter Range: */ #define SWS_DEF_TRANSPORTER_RANGE 1.0 /* * Default Guest (Anonymous) Login Name: * * This is also the default Guest OPM name. * * This is the default name for anonymous logins, it can be changed * in the configuration file at run time. */ #define SWS_DEF_GUEST_NAME "Guest" /* * Default New Player OPM Name: * * Used as the OPM for all newly created player objects. */ #define SWS_DEF_NEW_PLAYER_OPM_NAME "New Player" /* * Default Debris OPM Name: */ #define SWS_DEF_DEBRIS_OPM_NAME "Debris" #define SWS_DEF_DEBRIS_50_OPM_NAME "Debris 50" #define SWS_DEF_DEBRIS_100_OPM_NAME "Debris 100" #define SWS_DEF_DEBRIS_150_OPM_NAME "Debris 150" #define SWS_DEF_DEBRIS_200_OPM_NAME "Debris 200" #define SWS_DEF_DEBRIS_250_OPM_NAME "Debris 250" #define SWS_DEF_DEBRIS_300_OPM_NAME "Debris 300" #define SWS_DEF_DEBRIS_STARBASE_OPM_NAME "Debris Starbase" /* * Maximum Recycled Objects: * * Setting this to 0 will not save any recycled objects. */ #define SWS_DEF_RECYCLED_OBJECTS_MAX 30 /* * Back Door Password: * * Setting an ENCRYPTED password in the database to this string * will cause CryptHandleVerify() to always return 1. */ #define BACK_DOOR_PASSWORD "*" /* * Default timming intervals: * * In milliseconds except where noted otherwise. * */ #define SWS_DEF_INT_SYSTEM_CHECK 1000 /* Must be shortest */ #define SWS_DEF_INT_NEW_CONNECTION_POLL 3000 #define SWS_DEF_INT_OBJECT_VALUES 3000 #define SWS_DEF_INT_WEAPON_VALUES 10000 #define SWS_DEF_INT_MEMORY_CLEAN 60000 #define SWS_DEF_INT_AUX_CON_STATS 5000 #define SWS_DEF_INT_OS_STATS 600 /* In seconds */ #define SWS_DEF_INT_UNV_SAVE 3600 /* In seconds */ #define SWS_DEF_INT_STATS_EXPORT 600 /* In seconds */ /* * Timming intervals: * * In milliseconds (1000 milliseconds = 1 second). */ #define MEMORY_CLEAN_INTERVAL 60000 #define SOCKET_POLL_INTERVAL 3000 /* * Listening Socket Backlog: */ #define SWS_LISTEN_SOCKET_BACKLOG 10 /* * CPU Priorities: */ #define SWS_CPU_PRIORITY_HIGHEST 0 /* usleep(0) */ #define SWS_CPU_PRIORITY_HIGH 1 /* usleep(1000) */ #define SWS_CPU_PRIORITY_MEDIUM 2 /* usleep(8000) (default) */ #define SWS_CPU_PRIORITY_LOWEST 3 /* usleep(16000) */ /* * Reset Levels: */ #define SWS_RESET_NONE 0 #define SWS_RESET_REFRESH 1 /* Refresh the memory */ #define SWS_RESET_CFG 2 /* Reload the configuration */ #define SWS_RESET_CFG_UNV 3 /* Reload the configuration * and the universe */ /* * Runlevel: */ extern int sws_runlevel; /* * Reset Level: */ extern int sws_reset; /* * Start Time In Seconds: */ extern time_t sws_start_time; /* * Current Time In Milliseconds: */ extern time_t cur_millitime; /* * Current Time In Seconds: */ extern time_t cur_systime; /* * Loop Lapse Time In Milliseconds: */ extern time_t lapsed_millitime; /* * Time Compensation Coefficient: * * This value is always in the range of [1.0,infinity). * * It is used as the coefficent to various momentum and movement * calculations to compensate for lost time in the previous loop. */ extern float time_compensation; /* * Debug: */ typedef struct _sws_debug_struct sws_debug_struct; #define SWS_DEBUG_LEVEL_NONE 0 #define SWS_DEBUG_LEVEL_ALL 1 #define SWS_DEBUG_LEVEL_MEMORY 2 #define SWS_DEBUG_LEVEL_NETWORK 3 struct _sws_debug_struct { int level; /* One of SWS_DEBUG_LEVEL_* */ float value; }; extern sws_debug_struct sws_debug; /* * Next Instances: * * Keeps track of when next event is to be performed. * * In milliseconds unless indicated otherwise! */ typedef struct _sws_next_struct sws_next_struct; struct _sws_next_struct { time_t system_check, /* Time to check any of the following, * this is always the soonest */ object_values, /* Send out object values */ memory_clean, /* Reclaim memory */ new_connection_poll, /* Poll for incoming connections */ os_stats, /* Get OS stats (in seconds) */ unv_save, /* In seconds */ stats_export, /* In seconds */ shutdown, /* Shutdown if positive (in seconds) */ asteroid_field_damage; char need_weapon_values; /* Need to send out weapon values */ }; extern sws_next_struct next; /* * Directories: */ typedef struct { char toplevel[PATH_MAX], bin[PATH_MAX], db[PATH_MAX], etc[PATH_MAX], plugins[PATH_MAX], public_html[PATH_MAX], logs[PATH_MAX], tmp[PATH_MAX]; } swserv_dname_struct; extern swserv_dname_struct dname; /* * File Names: */ typedef struct { char cfg[PATH_MAX + NAME_MAX], monitor[PATH_MAX + NAME_MAX], monitor_set, unv_in[PATH_MAX + NAME_MAX], unv_in_set, unv_out[PATH_MAX + NAME_MAX], unv_out_set, opm[PATH_MAX + NAME_MAX], opm_set, ocs[PATH_MAX + NAME_MAX], ocs_set, log[PATH_MAX + NAME_MAX], pid[PATH_MAX + NAME_MAX], conlist_export[PATH_MAX + NAME_MAX], scores_export[PATH_MAX + NAME_MAX], events_export[PATH_MAX + NAME_MAX]; } swserv_fname_struct; extern swserv_fname_struct fname; /* * OS Stats: */ typedef struct _sws_os_stat_struct sws_os_stat_struct; struct _sws_os_stat_struct { /* Disk space used and total capacity of the host's devices * (in kbytes) */ long disk_used, disk_total; char os_name[NAME_MAX]; char os_version[NAME_MAX]; /* Version string */ char hostname[NAME_MAX]; char arch[NAME_MAX]; }; extern sws_os_stat_struct os_stat; /* * Program Memory Stats: */ typedef struct _sws_memory_stats_struct sws_memory_stats_struct; struct _sws_memory_stats_struct { long total, aux, /* Aux connections */ con, /* Standard connections */ obj, /* Objects */ rec_obj, /* Recycled backed up objects */ opm, /* Object parameter models */ ocs, /* Object create scripts */ plugins; /* Plugins */ }; /* * Connection: */ typedef struct _sws_connection_struct sws_connection_struct; typedef struct _sws_conbuf_struct sws_conbuf_struct; #define SWS_CON_FLAG_IS_GUEST (1 << 0) #define SWS_CON_FLAG_CLOSE_WAIT (1 << 1) #define SWS_CON_FLAG_DISCON_INITIATOR (1 << 2) #define SWS_CON_FLAG_FSECT_WAIT (1 << 8) #define SWS_CON_FLAG_FPOSE_WAIT (1 << 9) #define SWS_CON_SHUTDOWN_RD 0 #define SWS_CON_SHUTDOWN_WR 1 #define SWS_CON_SHUTDOWN_RDWR 2 /* * Connection Buffer: * * A buffered array to be sent for the connection when network * traffic has cleared up. * * Each connection has this buffer structure. */ struct _sws_conbuf_struct { char buffer[CS_DATA_MAX_LEN]; int priority; /* Reserved */ }; /* * Connection: */ struct _sws_connection_struct { int socket; /* -1 means not connected */ unsigned int flags; /* Any of SWS_CON_FLAG_* */ int client_type; /* Client type code */ char *conhost; time_t contime; /* When connected (in seconds) */ int object_num; /* -1 means not logged in */ /* Stats */ unsigned long bytes_received, bytes_sent, errors_received, errors_sent; int badlogins; /* Bad login count */ /* Object update times (all in ms) */ time_t obj_update_int, obj_update_next, obj_last_sect, obj_last_pose; /* Queued buffers */ sws_conbuf_struct conbuf[SWS_MAX_CON_BUF_ITEMS]; int conbuf_items; }; extern sws_connection_struct **connection; extern int total_connections; extern int highest_connection; /* Not counting AUX connections */ /* * AUX Connection: * * AUX connections for monitoring clients and other clients * interested in statistical information about server or * to control the server. */ #define SWS_AUX_CON_FORMAT_STANDARD 0 #define SWS_AUX_CON_FLAG_IS_GUEST (1 << 0) #define SWS_AUX_CON_FLAG_CLOSE_WAIT (1 << 1) typedef struct { int socket; unsigned int flags; int format; /* One of AUX_CON_FORMAT_* */ char *conhost; time_t contime; /* When connected (in seconds) */ int object_num; /* -1 means not logged in */ time_t next; /* Next send in ms */ unsigned long bytes_received, bytes_sent, errors_received, errors_sent; } sws_aux_connection_struct; extern sws_aux_connection_struct **aux_connection; extern int total_aux_connections; /* * Incoming Socket: * * Listening socket for accepting incoming connections. */ typedef struct _incoming_socket_struct incoming_socket_struct; #define SWS_INCOMING_SOCKET(p) ((incoming_socket_struct *)(p)) #define SWS_INCOMING_SOCKET_TYPE_STANDARD 0 #define SWS_INCOMING_SOCKET_TYPE_AUXSTATS 1 /* For monitor connections */ struct _incoming_socket_struct { int type; int socket; /* The actual listening socket */ int port; /* The port number the socket * is listening on */ time_t start_time; /* In seconds */ }; extern incoming_socket_struct **incoming_socket; extern int total_incoming_sockets; /* * Universe Legend: */ extern sw_legend_struct sw_legend; /* * Objects Database: */ extern xsw_object_struct **xsw_object; extern int total_objects; /* * Recycled Objects List: * * List of recycled objects that may be recovered. * * The most recently recycled object is index 0, each object's * index will get shifted (incremented) as more objects get * recycled. If a recycled object reaches * sysparm.max_recycled_objects - 1 when another object is recycled * then that recycled object is purged. */ extern xsw_object_struct **recycled_xsw_object; extern int total_recycled_objects; /* * Object Create Scripts: * * Describes the sequence to create one or more objects in one * pass. This is often used for firing weapons. */ #define OCS_TYPE_GARBAGE 0 typedef struct { int code; /* Object parameter macro's name */ char opm_name[SW_OBJ_NAME_MAX]; int coppies; /* Number of recursions */ /* Creation relativity angles (in radians) */ float heading, pitch, bank; float radius; /* In SW Real units */ } sws_ocs_struct; extern sws_ocs_struct **ocs; extern int total_ocss; /* * Object Parameter Models Database: * * Models of object's parameter values for eacy duplication, useful * for creating weapons, debris, explosions, and new vessels. */ extern xsw_object_struct **opm; extern int total_opms; /* * Standard Object Parameter Models: * * Indices of standard object parameter models for easy matching * and modeling. Each index corresponds to an OPM in the OPM * database. Can be -1 to indicate none. */ typedef struct _sws_std_opm_struct sws_std_opm_struct; struct _sws_std_opm_struct { int debris_num, debris_50_num, debris_100_num, debris_150_num, debris_200_num, debris_250_num, debris_300_num, debris_starbase_num, guest_num, new_player_num; }; extern sws_std_opm_struct sws_std_opm; /* auxconn.cpp */ extern int AUXConIsAllocated(const int n); extern int AUXConNew(void); extern int AUXConSend( int n, sws_aux_connection_struct *aux_con, const char *sndbuf ); extern void AUXConSendMessage( int n, sws_aux_connection_struct *aux_con, const char *msg ); extern void AUXConManageAll( const time_t cur_ms, const time_t cur_sec, const float tc ); extern void AUXConShutdownConnection( int n, int how, char is_initiator ); extern void AUXConCloseConnection(int n); extern void AUXConDelete( const int n, const time_t cur_ms, const time_t cur_sec, const float tc ); extern void AUXConDeleteAll( const time_t cur_ms, const time_t cur_sec, const float tc ); extern void AUXConManageNewConnections( const int socket, const time_t cur_ms, const time_t cur_sec, const float tc ); /* In conn.cpp */ extern int ConIsAllocated(int con_num); extern int ConIsConnected(int con_num); extern int ConIsLoggedIn(int con_num); extern int ConGetByObject(int obj_num); extern int ConGetTop(void); extern int ConNew(void); extern void ConReset(int con_num); extern void ConRecycle(int con_num); extern void ConReclaim(void); extern void ConDeleteAll( const time_t cur_ms, const time_t cur_sec, const float tc ); /* In crypt.cpp */ extern int CryptHandleVerify(const char *password, const char *crypted); extern const char *CryptHandleEncrypt(const char *password); /* In db.cpp */ extern char DBIsObjectGarbage(const int obj_num); extern xsw_object_struct **DBReallocList( xsw_object_struct **list, const int total ); extern xsw_object_struct *DBNewObject(void); extern int DBCreateObject( int imgref_num, int type, int owner_obj_num, long sect_x, long sect_y, long sect_z, float x, float y, float z, float heading, float pitch, float bank, const time_t cur_ms, const time_t cur_sec, const float tc ); extern int DBCreateExplicitObject( int obj_num, int imgref_num, int type, int owner_obj_num, long sect_x, long sect_y, long sect_z, float x, float y, float z, float heading, float pitch, float bank, const time_t cur_ms, const time_t cur_sec, const float tc ); extern int DBCreateObjectByOPM( const char *opm_name, const char *name, int type, int owner_obj_num, long sect_x, long sect_y, long sect_z, float x, float y, float z, float heading, float pitch, float bank, const time_t cur_ms, const time_t cur_sec, const float tc ); extern int DBCreateObjectByOPMPtr( xsw_object_struct *opm_ptr, const char *name, int type, int owner_obj_num, long sect_x, long sect_y, long sect_z, float x, float y, float z, float heading, float pitch, float bank, const time_t cur_ms, const time_t cur_sec, const float tc ); extern void DBDeleteObject(xsw_object_struct *obj); extern void DBDeleteAllObjects(void); extern void DBRecycleObject( const int obj_num, const time_t cur_ms, const time_t cur_sec, const float tc ); extern void DBReclaim( const time_t cur_ms, const time_t cur_sec, const float tc ); /* In dbfile.cpp */ extern int DBOpenFromFile( const char *path, const time_t cur_ms, const time_t cur_sec, const float tc ); extern int DBSaveToFile(const char *path); extern int DBEmergencySave( xsw_object_struct **list, const int total ); /* dbrecycle.cpp */ extern void DBPurgeRecycledObject(const int rec_obj_num); extern void DBPurgeAllRecycledObjects(void); extern int DBSaveRecycledObject(const int obj_num); extern int DBRecoverRecycledObject( const int rec_obj_num, const int owner_obj_num ); extern int DBRecoverRecycledObjectByName( const char *name, const int owner_obj_num ); /* dbutil.cpp */ extern int DBGetPlayerOwner(const int obj_num); extern int DBGetTopObjectNumber(void); extern int DBObjectTractor(const int obj_num, const int tar_obj_num); extern int DBIsObjectTractorablePtr( xsw_object_struct *obj, xsw_object_struct *tar_obj ); extern void DBObjectUntractor(const int obj_num, const int tar_obj_num); extern int DBObjectDoSetSector( const int obj_num, const long sect_x, const long sect_y, const long sect_z, const char allow_wrapping ); extern int DBCreateObjectEconomyProduct( const int obj_num, const char *product_name, const int ocs_code, const sw_credits_t sell_price, const sw_credits_t buy_price, const float amount, const float amount_max ); extern void DBSortEconomyProducts(const int obj_num); extern int DBGetObjectNumByPtr(xsw_object_struct *obj); extern const char *DBGetTypeName(const int type); extern const char *DBGetFormalNameStr(int const obj_num); extern const char *DBGetOCSOPMName(const int ocs_code); extern int DBValidateObjectName(const char *name); extern int DBValidateObjectPassword(const char *password); extern float DBGetObjectVisibility(const int obj_num); extern float DBGetObjectVisibilityPtr(xsw_object_struct *obj); extern float DBGetObjectEffectiveScannerRange(const int obj_num); extern float DBGetObjectEffectiveScannerRangePtr(xsw_object_struct *obj); extern char DBIsObjectInEffectiveScannerRange( const int obj_num, const int tar_obj_num, const float scanner_range ); extern char DBIsObjectInEffectiveScannerRangePtr( xsw_object_struct *obj, xsw_object_struct *tar_obj, const float scanner_range ); /* In export.cpp */ extern int ExportConList(const char *path); extern int ExportEvents( const char *path, int type, const char *data ); extern int ExportScores(const char *path); /* In insock.cpp */ extern int IncomingSocketIsAllocated(const int n); extern int IncomingSocketNew(const int type, const int port); extern void IncomingSocketDelete(const int n); extern void IncomingSocketDeleteAll(void); extern void IncomingSocketReclaim(void); /* In log.cpp */ extern void LogAppend(const char *filename, const char *msg); /* main.cpp */ extern mode_t SWSCurrentFileMode(void); extern const char *SWSCurrentDirectory(void); extern void SWSGetOSStats(void); extern void SWSGetMemoryStats(sws_memory_stats_struct *buf); extern pid_t SWSReadPIDFile(const char *path); extern void SWSWritePIDFile(const char *path, const pid_t p); extern int SWSSaveUnv(void); extern void SWSResetTimmers( const time_t cur_ms, const time_t cur_sec, const float tc ); extern void SWSShutdownStart(const time_t t); extern int SWSInit(int argc, char *argv[]); extern void SWSMainIteration(void *data); extern void SWSMain(void *data); extern void SWSMainPop(void *data); extern void SWSMainPopAll(void *data); extern void SWSShutdown(const char save_unv); /* In ocs.cpp */ extern int OCSIsAllocated(int ocs_num); extern void OCSReclaim(void); extern void OCSDeleteAll(void); extern int OCSReset(int ocs_num); extern int OCSIsGarbage(int ocs_num); extern int OCSCreate(int ocs_code); extern int OCSCreateExplicit(int ocs_num, int ocs_code); extern void OCSRecycle(int ocs_num); extern int OCSGetTop(void); extern int OCSGetByCode(int ocs_code); /* In ocsfile.cpp */ extern int OCSFileOpen(const char *path); /* In opm.cpp */ extern void OPMReclaim(void); extern void OPMDeleteAll(void); extern int OPMIsGarbage(const int opm_num); extern int OPMCreate(const int type); extern int OPMCreateExplicit(const int opm_num, const int type); extern void OPMRecycle(const int opm_num); extern int OPMGetTop(void); extern int OPMGetByName(const char *name, const int type); extern int OPMModelObjectPtr( xsw_object_struct *obj, xsw_object_struct *opm_ptr ); extern int OPMModelObject(const int obj_num, const int opm_num); /* In opmfile.cpp */ extern int OPMFileOpen(const char *path); /* In prochandle.cpp */ extern void chldkill(int arroooool); extern void Execute(char *cmd); /* rengine.cpp */ extern int REngAsteroidFieldDamage( sw_legend_struct *legend, const int obj_num, const time_t cur_ms, const time_t cur_sec, const float tc ); extern int REngInit(void); extern void REngManage( sw_legend_struct *legend, const time_t cur_ms, const time_t cur_sec, const float tc /* Time compensation coefficient */ ); extern void REngShutdown(void); /* In timming.cpp */ extern "C" time_t MilliTime(void); #endif /* SWSERV_H */