-/*\r
-Copyright (c) 2001, Loki software, inc.\r
-All rights reserved.\r
-\r
-Redistribution and use in source and binary forms, with or without modification, \r
-are permitted provided that the following conditions are met:\r
-\r
-Redistributions of source code must retain the above copyright notice, this list \r
-of conditions and the following disclaimer.\r
-\r
-Redistributions in binary form must reproduce the above copyright notice, this\r
-list of conditions and the following disclaimer in the documentation and/or\r
-other materials provided with the distribution.\r
-\r
-Neither the name of Loki software nor the names of its contributors may be used \r
-to endorse or promote products derived from this software without specific prior \r
-written permission. \r
-\r
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' \r
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \r
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE \r
-DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY \r
-DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES \r
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; \r
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON \r
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \r
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS \r
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \r
-*/\r
-\r
-#ifndef _BSPWINDOW_H_\r
-#define _BSPWINDOW_H_\r
-\r
-#include "l_net/l_net.h"\r
-\r
-class CWatchBSP\r
-{\r
-private:\r
- // a flag we have set to true when using an external BSP plugin\r
- // the resulting code with that is a bit dirty, cleaner solution would be to seperate the succession of commands from the listening loop\r
- // (in two seperate classes probably)\r
- bool m_bBSPPlugin;\r
-\r
- // EIdle: we are not listening\r
- // DoMonitoringLoop will change state to EBeginStep\r
- // EBeginStep: the socket is up for listening, we are expecting incoming connection\r
- // incoming connection will change state to EWatching\r
- // EWatching: we have a connection, monitor it\r
- // connection closed will see if we start a new step (EBeginStep) or launch Quake3 and end (EIdle)\r
- enum EWatchBSPState { EIdle, EBeginStep, EWatching } m_eState;\r
- socket_t *m_pListenSocket;\r
- socket_t *m_pInSocket;\r
- netmessage_t msg;\r
- GPtrArray *m_pCmd;\r
- // used to timeout EBeginStep\r
- GTimer *m_pTimer;\r
- unsigned int m_iCurrentStep;\r
- // name of the map so we can run the engine\r
- char *m_sBSPName;\r
- // buffer we use in push mode to receive data directly from the network\r
- xmlParserInputBufferPtr m_xmlInputBuffer;\r
- xmlParserInputPtr m_xmlInput;\r
- xmlParserCtxtPtr m_xmlParserCtxt;\r
- // call this to switch the set listening mode\r
- bool SetupListening();\r
- // start a new EBeginStep\r
- void DoEBeginStep();\r
- // the xml and sax parser state\r
- char m_xmlBuf[MAX_NETMESSAGE];\r
- bool m_bNeedCtxtInit;\r
- message_info_s m_message_info;\r
-\r
-public:\r
- CWatchBSP() { m_bBSPPlugin = false; m_pListenSocket = NULL; m_pInSocket = NULL; m_eState = EIdle; m_pTimer = g_timer_new(); m_sBSPName = NULL; m_xmlInputBuffer = NULL; m_bNeedCtxtInit = true; }\r
- virtual ~CWatchBSP();\r
- bool HasBSPPlugin () const\r
- { return m_bBSPPlugin; }\r
-\r
- // called regularly to keep listening\r
- void RoutineProcessing();\r
- // start a monitoring loop with the following steps\r
- void DoMonitoringLoop( GPtrArray *pCmd, char *sBSPName );\r
- // close everything - may be called from the outside to abort the process\r
- void Reset();\r
- // start a listening loop for an external process, possibly a BSP plugin\r
- void ExternalListen();\r
-};\r
-\r
-void WINAPI QERApp_Listen();\r
-\r
-#endif\r
+/*
+Copyright (c) 2001, Loki software, inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list
+of conditions and the following disclaimer.
+
+Redistributions in binary form must reproduce the above copyright notice, this
+list of conditions and the following disclaimer in the documentation and/or
+other materials provided with the distribution.
+
+Neither the name of Loki software nor the names of its contributors may be used
+to endorse or promote products derived from this software without specific prior
+written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef _BSPWINDOW_H_
+#define _BSPWINDOW_H_
+
+#include "l_net/l_net.h"
+
+class CWatchBSP
+{
+private:
+ // a flag we have set to true when using an external BSP plugin
+ // the resulting code with that is a bit dirty, cleaner solution would be to seperate the succession of commands from the listening loop
+ // (in two seperate classes probably)
+ bool m_bBSPPlugin;
+
+ // EIdle: we are not listening
+ // DoMonitoringLoop will change state to EBeginStep
+ // EBeginStep: the socket is up for listening, we are expecting incoming connection
+ // incoming connection will change state to EWatching
+ // EWatching: we have a connection, monitor it
+ // connection closed will see if we start a new step (EBeginStep) or launch Quake3 and end (EIdle)
+ enum EWatchBSPState { EIdle, EBeginStep, EWatching } m_eState;
+ socket_t *m_pListenSocket;
+ socket_t *m_pInSocket;
+ netmessage_t msg;
+ GPtrArray *m_pCmd;
+ // used to timeout EBeginStep
+ GTimer *m_pTimer;
+ unsigned int m_iCurrentStep;
+ // name of the map so we can run the engine
+ char *m_sBSPName;
+ // buffer we use in push mode to receive data directly from the network
+ xmlParserInputBufferPtr m_xmlInputBuffer;
+ xmlParserInputPtr m_xmlInput;
+ xmlParserCtxtPtr m_xmlParserCtxt;
+ // call this to switch the set listening mode
+ bool SetupListening();
+ // start a new EBeginStep
+ void DoEBeginStep();
+ // the xml and sax parser state
+ char m_xmlBuf[MAX_NETMESSAGE];
+ bool m_bNeedCtxtInit;
+ message_info_s m_message_info;
+
+public:
+ CWatchBSP() { m_bBSPPlugin = false; m_pListenSocket = NULL; m_pInSocket = NULL; m_eState = EIdle; m_pTimer = g_timer_new(); m_sBSPName = NULL; m_xmlInputBuffer = NULL; m_bNeedCtxtInit = true; }
+ virtual ~CWatchBSP();
+ bool HasBSPPlugin () const
+ { return m_bBSPPlugin; }
+
+ // called regularly to keep listening
+ void RoutineProcessing();
+ // start a monitoring loop with the following steps
+ void DoMonitoringLoop( GPtrArray *pCmd, char *sBSPName );
+ // close everything - may be called from the outside to abort the process
+ void Reset();
+ // start a listening loop for an external process, possibly a BSP plugin
+ void ExternalListen();
+};
+
+void WINAPI QERApp_Listen();
+
+#endif