Introduction Manual Class Reference Header Reference

zoidcom.h

Go to the documentation of this file.
00001 /****************************************
00002 * zoidcom.h
00003 * ZoidCom main header
00004 *
00005 * This file is part of the "Zoidcom Automated Networking System" application library.
00006 * Copyright (C)2002-2007 by Joerg Rueppel. See documentation for copyright and licensing details.
00007 *****************************************/
00008 
00009 #ifndef _ZOIDCOM_H_
00010 #define _ZOIDCOM_H_
00011 
00012 #include "zoidcom_prereq.h"
00013 
00017 class ZoidCom_Private;
00018 
00023 enum eZCom_SocketType
00024 {
00026   eZCom_SocketLocal,
00028   eZCom_SocketTCP,
00030   eZCom_SocketUDP,
00031   eZCom_SocketCount
00032 };
00033 
00036 enum eZCom_BlockMode
00037 {
00039   eZCom_Block,
00041   eZCom_NoBlock
00042 };
00043 
00046 enum eZCom_DependencyOpt
00047 {
00048   eZCom_AddDependency,
00049   eZCom_RemoveDependency
00050 };
00051 
00054 enum eZCom_DiscoverOpt
00055 {
00057   eZCom_DiscoverEnable,
00059   eZCom_DiscoverDisableAndKeep,
00061   eZCom_DiscoverDisable
00062 };
00063 
00066 enum eZCom_AddressType
00067 {
00069   eZCom_AddressLocal,
00071   eZCom_AddressTCP,
00073   eZCom_AddressUDP,
00075   eZCom_AddressBroadcast
00076 };
00077 
00080 enum eZCom_GetIPAddressOption
00081 {
00083   eZCom_AddressWithPort,
00085   eZCom_AddressWithoutPort
00086 };
00087 
00089 enum eZCom_ConnectResult
00090 {
00092   eZCom_ConnAccepted,
00094   eZCom_ConnDenied,
00096   eZCom_ConnTimeout,
00098   eZCom_ConnHostnameFailed,
00100   eZCom_ConnWrongVersion
00101 };
00102 
00104 enum eZCom_CloseReason
00105 {
00107   eZCom_ClosedDisconnect,
00109   eZCom_ClosedTimeout,
00111   eZCom_ClosedReconnect
00112 };
00113 
00115 enum eZCom_ZoidResult
00116 {
00118   eZCom_ZoidEnabled,
00120   eZCom_ZoidDenied,
00122   eZCom_ZoidFailed_System,
00124   eZCom_ZoidFailed_Node,
00126   eZCom_ZoidDisabled
00127 };
00128 
00130 enum eZCom_HostnameResult
00131 {
00133   eZCom_HostnameIdle,
00135   eZCom_HostnameFailed,
00137   eZCom_HostnameSuccess,
00139   eZCom_HostnameInProgress
00140 };
00141 
00146 enum eZCom_NodeRole
00147 {
00149   eZCom_RoleUndefined,
00151   eZCom_RoleProxy,
00153   eZCom_RoleOwner,
00155   eZCom_RoleAuthority
00156 };
00157 
00160 enum eZCom_SendMode
00161 {
00163   eZCom_ReliableUnordered,
00165   eZCom_ReliableOrdered,
00167   eZCom_Unreliable,
00170   eZCom_UnreliableNotify
00171 };
00172 
00175 enum eZCom_Event
00176 {
00177   eZCom_EventNoEvent,
00178 
00179   /* system events */
00180 
00185   eZCom_EventInit,
00193   eZCom_EventSyncRequest,
00200   eZCom_EventRemoved,
00201 
00205   eZCom_EventFile_Incoming,
00211   eZCom_EventFile_Data,
00214   eZCom_EventFile_Aborted,
00217   eZCom_EventFile_Complete,
00218 
00219   /* replicator events */
00220 
00221   // replicator is sending some data through node event system (internal)
00222   eZCom_EventReplicator,
00223 
00224   /* normal events */
00225 
00227   eZCom_EventUser
00228 };
00229 
00231 typedef zU32 ZCom_ConnID;
00233 typedef zU32 ZCom_ClassID;
00235 typedef zU32 ZCom_NodeID;
00237 typedef zU32 ZCom_FileTransID;
00239 typedef zU32 ZCom_GroupID;
00241 typedef zU8  ZCom_InterceptID;
00242 
00243 const ZCom_ClassID ZCom_Invalid_ID = 0;
00244 
00245 /***********************/
00246 /* Connection Stats    */
00247 /***********************/
00248 
00250 struct ZCom_ConnStats
00251 {
00253   zU32  last_in;
00255   zU32  last_out;
00257   zU32  last_sec_out, last_sec_in;
00259   zU32  last_sec_outp, last_sec_inp;
00261   zU32  current_out, current_in;
00263   zU32  current_outp, current_inp;
00265   zU32  total_out, total_in;
00267   zU32 last_interval_update;
00269   zU16  ping;
00271   zU16 avg_ping;
00273   zU8 last_sec_loss_percent;
00275   zU8 last_sec_loss_count;
00277   zU8 current_loss_count;
00278 };
00279 
00280 /***********************/
00281 /* File transfer info  */
00282 /***********************/
00283 
00285 struct ZCom_FileTransInfo
00286 {
00288   ZCom_FileTransID id;
00290   zU32 size;
00292   zU32 transferred;
00298   const char  *path;
00300   zU32 bps;
00301 };
00302 
00303 /* ===================================== */
00304 
00308 class ZCOM_API ZoidCom
00309 {
00310 private:
00311   ZoidCom_Private *m_priv;
00312 public:
00313   ZoidCom();
00314   ZoidCom( const char *_logfile );
00315   ZoidCom( void ( *_logfunc ) ( const char* ) );
00316   ~ZoidCom();
00317 
00318   /* init & exit */
00319 
00320   bool
00321     Init();
00322 
00323   void
00324     Clear( void );
00325 
00326   /* global setup */
00327 
00335   void
00336     setConnectionTimeout(zU32 _timeout);
00337 
00348   void
00349     setResendTimeout(zU32 _timeout);
00350 
00351 
00362   static void
00363     overrideMemoryHandlers(void*(*_allocator)(size_t _size), void(*_deallocator)(void *_ptr));
00364 
00370   void
00371     setLogLevel(zU8 _level);
00372 
00378   static zU32
00379     getTime();
00380 
00386   static void
00387     Sleep(zU32 _msecs);
00388 };
00389 
00390 #include "zoidcom_bitstream.h"
00391 #include "zoidcom_address.h"
00392 #include "zoidcom_control.h"
00393 #include "zoidcom_node.h"
00394 #include "zoidcom_node_interceptors.h"
00395 #include "zoidcom_conngroup.h"
00396 #include "zoidcom_replicator.h"
00397 #include "zoidcom_replicator_basic.h"
00398 #include "zoidcom_replicator_advanced.h"
00399 #include "zoidcom_replicator_numeric.h"
00400 #include "zoidcom_replicator_bool.h"
00401 #include "zoidcom_replicator_memblock.h"
00402 #include "zoidcom_replicator_string.h"
00403 #include "zoidcom_replicator_interpolate.h"
00404 #include "zoidcom_replicator_movement.h"
00405 
00406 #endif

This file is part of the documentation for Zoidcom. Documentation copyright © 2004-2008 by Jörg Rüppel. Generated on Sat Aug 16 15:26:49 2008 for Zoidcom by doxygen 1.4.6-NO