mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
build nativenet on Linux
This commit is contained in:
parent
f05b41cc96
commit
0db570a622
@ -19,6 +19,8 @@
|
||||
// to a subsequent version of Panda.
|
||||
// *******************************************************************
|
||||
|
||||
#define IS_LINUX 1
|
||||
|
||||
// What additional flags should we pass to interrogate?
|
||||
#define SYSTEM_IGATE_FLAGS -D__i386__ -D__const=const -Dvolatile=
|
||||
|
||||
|
@ -19,10 +19,13 @@
|
||||
// to a subsequent version of Panda.
|
||||
// *******************************************************************
|
||||
|
||||
#define IS_OSX 1
|
||||
|
||||
// Assume that OSX has OpenGL available.
|
||||
#define HAVE_GL 1
|
||||
|
||||
// What additional flags should we pass to interrogate?
|
||||
#define SYSTEM_IGATE_FLAGS -D__FLT_EVAL_METHOD__=0 -D__i386__ -D__const=const -Dvolatile -D__LITTLE_ENDIAN__ -D__inline__=inline -D__GNUC__
|
||||
#define HAVE_GL 1
|
||||
#define IS_OSX 1
|
||||
|
||||
// We don't need worry about defining WORDS_BIGENDIAN (and we
|
||||
// shouldn't anyway, since ppc and intel are different). We rely on
|
||||
|
@ -410,6 +410,10 @@
|
||||
#define NSPR_LIBS nspr4
|
||||
#defer HAVE_NSPR $[isfile $[NSPR_IPATH]/prtypes.h]
|
||||
|
||||
// Define this true to build a native network implementation,
|
||||
// bypassing NSPR.
|
||||
#define WANT_NATIVE_NET
|
||||
|
||||
// Is a third-party STL library installed, and where? This is only
|
||||
// necessary if the default include and link lines that come with the
|
||||
// compiler don't provide adequate STL support. At least some form of
|
||||
|
@ -506,7 +506,7 @@ $[cdefine USE_MEMORY_PTMALLOC2]
|
||||
$[cdefine USE_MEMORY_MALLOC]
|
||||
$[cdefine USE_MEMORY_NOWRAPPERS]
|
||||
|
||||
#define if we want native net
|
||||
// If we are to build the native net interfaces.
|
||||
$[cdefine WANT_NATIVE_NET]
|
||||
|
||||
|
||||
@ -514,7 +514,9 @@ $[cdefine WANT_NATIVE_NET]
|
||||
$[cdefine USE_STL_ALLOCATOR]
|
||||
|
||||
|
||||
/* Platform-identifying defines. */
|
||||
$[cdefine IS_OSX]
|
||||
$[cdefine IS_LINUX]
|
||||
|
||||
|
||||
#end dtool_config.h
|
||||
|
@ -11,5 +11,6 @@
|
||||
avcodec.h avformat.h avio.h avutil.h common.h integer.h \
|
||||
intfloat_readwrite.h mathematics.h rational.h rtp.h \
|
||||
rtsp.h rtspcodes.h winsock2.h \
|
||||
ode/config.h ode/common.h collision_trimesh.h
|
||||
ode/config.h ode/common.h collision_trimesh.h \
|
||||
netinet/tcp.h netinet/ip.h
|
||||
|
||||
|
22
dtool/src/parser-inc/ip.h
Normal file
22
dtool/src/parser-inc/ip.h
Normal file
@ -0,0 +1,22 @@
|
||||
// Filename: ip.h
|
||||
// Created by: drose (08Feb07)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d-general@lists.sourceforge.net .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This file, and all the other files in this directory, aren't
|
||||
// intended to be compiled--they're just parsed by CPPParser (and
|
||||
// interrogate) in lieu of the actual system headers, to generate the
|
||||
// interrogate database.
|
22
dtool/src/parser-inc/tcp.h
Normal file
22
dtool/src/parser-inc/tcp.h
Normal file
@ -0,0 +1,22 @@
|
||||
// Filename: tcp.h
|
||||
// Created by: drose (08Feb07)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d-general@lists.sourceforge.net .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This file, and all the other files in this directory, aren't
|
||||
// intended to be compiled--they're just parsed by CPPParser (and
|
||||
// interrogate) in lieu of the actual system headers, to generate the
|
||||
// interrogate database.
|
@ -11,12 +11,10 @@
|
||||
// 3. Handle Framing and Unframing properly ..
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#include "dtoolbase.h"
|
||||
#include <vector>
|
||||
#include "pandabase.h"
|
||||
#include "socket_base.h"
|
||||
//#include "../express/datagram.h"
|
||||
#include "datagram.h"
|
||||
|
||||
#include "pvector.h"
|
||||
#include "buffered_datagramreader.h"
|
||||
#include "buffered_datagramwriter.h"
|
||||
|
||||
@ -31,7 +29,7 @@
|
||||
class EXPCL_PANDA Buffered_DatagramConnection : protected Socket_TCP
|
||||
{
|
||||
private:
|
||||
struct AddressQueue : private std::vector<Socket_Address> // this is used to do a round robin for addres to connect to ..
|
||||
struct AddressQueue : private pvector<Socket_Address> // this is used to do a round robin for addres to connect to ..
|
||||
{
|
||||
size_t _active_index;
|
||||
bool GetNext(Socket_Address &out)
|
||||
@ -46,17 +44,17 @@ private:
|
||||
return true;
|
||||
}
|
||||
|
||||
void clear() { std::vector<Socket_Address>::clear(); };
|
||||
void clear() { pvector<Socket_Address>::clear(); };
|
||||
void push_back(Socket_Address &address)
|
||||
{
|
||||
iterator ii;
|
||||
for(ii = begin(); ii != end(); ii++)
|
||||
if(*ii == address)
|
||||
return;
|
||||
std::vector<Socket_Address>::push_back(address);
|
||||
pvector<Socket_Address>::push_back(address);
|
||||
}
|
||||
|
||||
size_t size() { return std::vector<Socket_Address>::size(); };
|
||||
size_t size() { return pvector<Socket_Address>::size(); };
|
||||
};
|
||||
protected:
|
||||
// c++ upcals for
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
int gotbytes = sck.RecvData(ff,(int)readsize);
|
||||
if(gotbytes < 0) // some error
|
||||
{
|
||||
int er = GETERROR();
|
||||
//int er = GETERROR();
|
||||
if(!sck.ErrorIs_WouldBlocking(gotbytes) )
|
||||
{
|
||||
answer = -3; // hard error ?
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
|
||||
if(Writesize > 0) {
|
||||
int Writen = sck.SendData(GetMessageHead(),(int)Writesize);
|
||||
if(_are_we_going_to_block_on_write == true && Writen < 0 && sck.ErrorIs_WouldBlocking(Writen) == TRUE) {
|
||||
if(_are_we_going_to_block_on_write == true && Writen < 0 && sck.ErrorIs_WouldBlocking(Writen) == true) {
|
||||
//sck.SetBlocking();
|
||||
Writen = sck.SendData(GetMessageHead(),(int)Writesize);
|
||||
//sck.SetNonBlocking();
|
||||
@ -74,7 +74,7 @@ public:
|
||||
answer = 1;
|
||||
}
|
||||
else if(Writen < 0) {
|
||||
if(sck.ErrorIs_WouldBlocking(Writen) != TRUE)
|
||||
if(sck.ErrorIs_WouldBlocking(Writen) != true)
|
||||
answer = -1;
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
#ifndef __SOCKET_ADDRESS_H__
|
||||
#define __SOCKET_ADDRESS_H__
|
||||
|
||||
#include <string>
|
||||
#include "dtoolbase.h"
|
||||
#include "pandabase.h"
|
||||
#include "numeric_types.h"
|
||||
|
||||
///////////////////////////////////
|
||||
// Class : Socket_Address
|
||||
//
|
||||
@ -202,7 +202,7 @@ inline bool Socket_Address::set_host(const std::string &hostname, int port)
|
||||
//
|
||||
//
|
||||
|
||||
UINT32 addr = (long)inet_addr (hostname.c_str());
|
||||
PN_uint32 addr = (long)inet_addr (hostname.c_str());
|
||||
if(addr == INADDR_NONE)
|
||||
{
|
||||
hp = gethostbyname(hostname.c_str());
|
||||
@ -241,7 +241,7 @@ inline bool Socket_Address::set_host(const std::string &hostname)
|
||||
// Function name : Socket_Address::set_host
|
||||
// Description :
|
||||
//////////////////////////////////////////////////////////////
|
||||
inline bool Socket_Address::set_host(UINT32 in_hostname, int port)
|
||||
inline bool Socket_Address::set_host(PN_uint32 in_hostname, int port)
|
||||
{
|
||||
memcpy(&_addr.sin_addr, &in_hostname, sizeof(in_hostname));
|
||||
_addr.sin_port = htons(port);
|
||||
@ -276,7 +276,7 @@ inline bool Socket_Address::operator < (const Socket_Address &in) const
|
||||
//////////////////////////////////////////////////////////////
|
||||
inline bool Socket_Address::isMcastRange(void)
|
||||
{
|
||||
UINT32 address = ntohl(_addr.sin_addr.s_addr);
|
||||
PN_uint32 address = ntohl(_addr.sin_addr.s_addr);
|
||||
//224.0.0.0-239.255.255.255 .. e0,ef
|
||||
if(address >= 0xe0000000 && address < 0xefffffff)
|
||||
return true;
|
||||
|
@ -1,8 +1,10 @@
|
||||
#ifndef __SOCKET_BASE_H__
|
||||
#define __SOCKET_BASE_H__
|
||||
|
||||
////////////////////////////////////////////
|
||||
// Quick way to get all the network code defined
|
||||
////////////////////////////////////////////
|
||||
#include "pandabase.h"
|
||||
#include "socket_portable.h"
|
||||
#include "socket_address.h"
|
||||
#include "socket_ip.h"
|
||||
|
@ -11,6 +11,8 @@
|
||||
// fits more with the normal Berkeley mind set... ** Not ** Should think about using POLL() on BSD-based systems
|
||||
//
|
||||
//////////////////////////////////////////////////////////
|
||||
#include "pandabase.h"
|
||||
#include "numeric_types.h"
|
||||
#include "time_base.h"
|
||||
|
||||
class Socket_fdset
|
||||
@ -20,9 +22,9 @@ public:
|
||||
inline Socket_fdset();
|
||||
inline void setForSocket(const Socket_IP &incon);
|
||||
inline bool IsSetFor(const Socket_IP & incon) const;
|
||||
inline int WaitForRead(bool zeroFds, UINT32 sleep_time = 0xffffffff);
|
||||
inline int WaitForWrite(bool zeroFds, UINT32 sleep_time = 0xffffffff);
|
||||
inline int WaitForError(bool zeroFds, UINT32 sleep_time = 0xffffffff);
|
||||
inline int WaitForRead(bool zeroFds, PN_uint32 sleep_time = 0xffffffff);
|
||||
inline int WaitForWrite(bool zeroFds, PN_uint32 sleep_time = 0xffffffff);
|
||||
inline int WaitForError(bool zeroFds, PN_uint32 sleep_time = 0xffffffff);
|
||||
|
||||
|
||||
inline int WaitForRead(bool zeroFds, const Time_Span & timeout);
|
||||
@ -90,7 +92,7 @@ inline bool Socket_fdset::IsSetFor(const Socket_IP & incon) const
|
||||
// Function name : WaitForRead
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
inline int Socket_fdset::WaitForRead(bool zeroFds, UINT32 sleep_time)
|
||||
inline int Socket_fdset::WaitForRead(bool zeroFds, PN_uint32 sleep_time)
|
||||
{
|
||||
int retVal = 0;
|
||||
if (sleep_time == 0xffffffff)
|
||||
@ -151,7 +153,7 @@ inline void Socket_fdset::setForSocket(const Socket_IP &incon)
|
||||
// Description : This is the function that will wait till
|
||||
// one of the sockets is ready for writing
|
||||
////////////////////////////////////////////////////////////////////
|
||||
inline int Socket_fdset::WaitForWrite(bool zeroFds, UINT32 sleep_time)
|
||||
inline int Socket_fdset::WaitForWrite(bool zeroFds, PN_uint32 sleep_time)
|
||||
{
|
||||
int retVal = 0;
|
||||
if (sleep_time == 0xffffffff)
|
||||
@ -177,7 +179,7 @@ inline int Socket_fdset::WaitForWrite(bool zeroFds, UINT32 sleep_time)
|
||||
// Description : This is the function that will wait till
|
||||
// one of the sockets is in error state
|
||||
//////////////////////////////////////////////////////////////
|
||||
inline int Socket_fdset::WaitForError(bool zeroFds, UINT32 sleep_time)
|
||||
inline int Socket_fdset::WaitForError(bool zeroFds, PN_uint32 sleep_time)
|
||||
{
|
||||
int retVal = 0;
|
||||
if (sleep_time == 0xffffffff)
|
||||
|
@ -244,7 +244,7 @@ const int LOCAL_CONNECT_BLOCKING = EINPROGRESS;
|
||||
* LINUX and FreeBSD STUFF
|
||||
************************************************************************/
|
||||
|
||||
#elif defined(Linux) || defined(FreeBSD) ||defined(LINUX)
|
||||
#elif defined(IS_LINUX) || defined(FreeBSD)
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
|
@ -9,6 +9,9 @@
|
||||
// platform differences from machine to machine
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
#include "pandabase.h"
|
||||
#include "numeric_types.h"
|
||||
|
||||
#include <openssl/rsa.h> /* SSLeay stuff */
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/x509.h>
|
||||
@ -281,12 +284,12 @@ inline void Socket_TCP_SSL::DetailErrorFormat(void)
|
||||
{
|
||||
return; // turn on fir debuging
|
||||
|
||||
UINT32 l;
|
||||
PN_uint32 l;
|
||||
char buf[256];
|
||||
char buf2[4096];
|
||||
const char *file,*data;
|
||||
int line,flags;
|
||||
UINT32 es;
|
||||
PN_uint32 es;
|
||||
|
||||
es=CRYPTO_thread_id();
|
||||
while ((l=ERR_get_error_line_data(&file,&line,&data,&flags)) != 0)
|
||||
|
@ -247,7 +247,7 @@ inline std::string Time_Clock::Format(char * pFormat) const
|
||||
*pch++ = ch1;
|
||||
break;
|
||||
case 'N':
|
||||
pch += sprintf(pch, "%03d", _my_time.tv_usec / 1000);
|
||||
pch += sprintf(pch, "%03ld", _my_time.tv_usec / 1000);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -295,7 +295,7 @@ inline std::string Time_Clock::FormatGmt(char * pFormat) const
|
||||
*pch++ = ch1;
|
||||
break;
|
||||
case 'N':
|
||||
pch += sprintf(pch, "%03d", _my_time.tv_usec / 1000);
|
||||
pch += sprintf(pch, "%03ld", _my_time.tv_usec / 1000);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -372,7 +372,7 @@ inline std::string Time_Span::Format(char * pFormat) const
|
||||
pch += sprintf(pch, "%02d", GetSeconds());
|
||||
break;
|
||||
case 'N':
|
||||
pch += sprintf(pch, "%03d", _my_time.tv_usec / 1000);
|
||||
pch += sprintf(pch, "%03ld", _my_time.tv_usec / 1000);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user