rename TcpSocket to NetSocket

This commit is contained in:
piratfm 2010-01-16 15:21:09 +00:00
parent afc5439aa7
commit d3eb9525dc
11 changed files with 57 additions and 57 deletions

View File

@ -132,7 +132,7 @@ Next release
20-10-2002: DarkIce 0.12 released 20-10-2002: DarkIce 0.12 released
o ported to FreeBSD (removed reference to MSG_NOSIGNAL in TcpSocket.cpp) o ported to FreeBSD (removed reference to MSG_NOSIGNAL in NetSocket.cpp)
o bug fix: maximum bitrate setting fixed for Ogg Vorbis streams o bug fix: maximum bitrate setting fixed for Ogg Vorbis streams
o changed internals so that now each encoding/server connection is o changed internals so that now each encoding/server connection is
a separate thread a separate thread

View File

@ -54,7 +54,7 @@ static const char fileid[] = "$Id$";
* Initialize the object * Initialize the object
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
void void
CastSink :: init ( TcpSocket * socket, CastSink :: init ( NetSocket * socket,
Sink * streamDump, Sink * streamDump,
const char * password, const char * password,
unsigned int bitRate, unsigned int bitRate,

View File

@ -39,7 +39,7 @@
#include "Ref.h" #include "Ref.h"
#include "Reporter.h" #include "Reporter.h"
#include "Sink.h" #include "Sink.h"
#include "TcpSocket.h" #include "NetSocket.h"
#include "BufferedSink.h" #include "BufferedSink.h"
@ -66,7 +66,7 @@ class CastSink : public Sink, public virtual Reporter
/** /**
* The socket connection to the server. * The socket connection to the server.
*/ */
Ref<TcpSocket> socket; Ref<NetSocket> socket;
/** /**
* The BufferedSink encapsulating the socket connection to the server. * The BufferedSink encapsulating the socket connection to the server.
@ -128,7 +128,7 @@ class CastSink : public Sink, public virtual Reporter
* @exception Exception * @exception Exception
*/ */
void void
init ( TcpSocket * socket, init ( NetSocket * socket,
Sink * streamDump, Sink * streamDump,
const char * password, const char * password,
unsigned int bitRate, unsigned int bitRate,
@ -182,11 +182,11 @@ class CastSink : public Sink, public virtual Reporter
} }
/** /**
* Get the TcpSocket underneath this CastSink. * Get the NetSocket underneath this CastSink.
* *
* @return pointer to the TcpSocket underneath this CastSink. * @return pointer to the NetSocket underneath this CastSink.
*/ */
inline TcpSocket * inline NetSocket *
getSocket ( void ) const throw () getSocket ( void ) const throw ()
{ {
return socket.get(); return socket.get();
@ -211,7 +211,7 @@ class CastSink : public Sink, public virtual Reporter
* @exception Exception * @exception Exception
*/ */
inline inline
CastSink ( TcpSocket * socket, CastSink ( NetSocket * socket,
const char * password, const char * password,
unsigned int bitRate, unsigned int bitRate,
const char * name = 0, const char * name = 0,

View File

@ -345,7 +345,7 @@ DarkIce :: configIceCast ( const Config & config,
} }
} }
// streaming related stuff // streaming related stuff
audioOuts[u].socket = new TcpSocket( server, port); audioOuts[u].socket = new NetSocket( server, port);
audioOuts[u].server = new IceCast( audioOuts[u].socket.get(), audioOuts[u].server = new IceCast( audioOuts[u].socket.get(),
password, password,
mountPoint, mountPoint,
@ -558,7 +558,7 @@ DarkIce :: configIceCast2 ( const Config & config,
} }
// streaming related stuff // streaming related stuff
audioOuts[u].socket = new TcpSocket( server, port); audioOuts[u].socket = new NetSocket( server, port);
audioOuts[u].server = new IceCast2( audioOuts[u].socket.get(), audioOuts[u].server = new IceCast2( audioOuts[u].socket.get(),
password, password,
mountPoint, mountPoint,
@ -829,7 +829,7 @@ DarkIce :: configShoutCast ( const Config & config,
} }
// streaming related stuff // streaming related stuff
audioOuts[u].socket = new TcpSocket( server, port); audioOuts[u].socket = new NetSocket( server, port);
audioOuts[u].server = new ShoutCast( audioOuts[u].socket.get(), audioOuts[u].server = new ShoutCast( audioOuts[u].socket.get(),
password, password,
mountPoint, mountPoint,

View File

@ -56,7 +56,7 @@
#include "BufferedSink.h" #include "BufferedSink.h"
#include "Connector.h" #include "Connector.h"
#include "AudioEncoder.h" #include "AudioEncoder.h"
#include "TcpSocket.h" #include "NetSocket.h"
#include "CastSink.h" #include "CastSink.h"
#include "DarkIceConfig.h" #include "DarkIceConfig.h"
@ -90,7 +90,7 @@ class DarkIce : public virtual Referable, public virtual Reporter
*/ */
typedef struct { typedef struct {
Ref<AudioEncoder> encoder; Ref<AudioEncoder> encoder;
Ref<TcpSocket> socket; Ref<NetSocket> socket;
Ref<CastSink> server; Ref<CastSink> server;
} Output; } Output;

View File

@ -37,7 +37,7 @@
/* ============================================================ include files */ /* ============================================================ include files */
#include "Sink.h" #include "Sink.h"
#include "TcpSocket.h" #include "NetSocket.h"
#include "CastSink.h" #include "CastSink.h"
@ -143,7 +143,7 @@ class IceCast : public CastSink
* @exception Exception * @exception Exception
*/ */
inline inline
IceCast ( TcpSocket * socket, IceCast ( NetSocket * socket,
const char * password, const char * password,
const char * mountPoint, const char * mountPoint,
unsigned int bitRate, unsigned int bitRate,

View File

@ -37,7 +37,7 @@
/* ============================================================ include files */ /* ============================================================ include files */
#include "Sink.h" #include "Sink.h"
#include "TcpSocket.h" #include "NetSocket.h"
#include "CastSink.h" #include "CastSink.h"
@ -151,7 +151,7 @@ class IceCast2 : public CastSink
* @exception Exception * @exception Exception
*/ */
inline inline
IceCast2 ( TcpSocket * socket, IceCast2 ( NetSocket * socket,
const char * password, const char * password,
const char * mountPoint, const char * mountPoint,
StreamFormat format, StreamFormat format,

View File

@ -62,8 +62,8 @@ darkice_SOURCES = AudioEncoder.h\
Referable.h\ Referable.h\
Sink.h\ Sink.h\
Source.h\ Source.h\
TcpSocket.cpp\ NetSocket.cpp\
TcpSocket.h\ NetSocket.h\
Util.cpp\ Util.cpp\
Util.h\ Util.h\
ConfigSection.h\ ConfigSection.h\

View File

@ -4,7 +4,7 @@
Tyrell DarkIce Tyrell DarkIce
File : TcpSocket.cpp File : NetSocket.cpp
Version : $Revision$ Version : $Revision$
Author : $Author$ Author : $Author$
Location : $HeadURL$ Location : $HeadURL$
@ -90,7 +90,7 @@
#include "Util.h" #include "Util.h"
#include "Exception.h" #include "Exception.h"
#include "TcpSocket.h" #include "NetSocket.h"
/* =================================================== local data structures */ /* =================================================== local data structures */
@ -113,7 +113,7 @@ static const char fileid[] = "$Id$";
* Initialize the object * Initialize the object
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
void void
TcpSocket :: init ( const char * host, NetSocket :: init ( const char * host,
unsigned short port ) throw ( Exception ) unsigned short port ) throw ( Exception )
{ {
this->host = Util::strDup( host); this->host = Util::strDup( host);
@ -126,7 +126,7 @@ TcpSocket :: init ( const char * host,
* De-initialize the object * De-initialize the object
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
void void
TcpSocket :: strip ( void) throw ( Exception ) NetSocket :: strip ( void) throw ( Exception )
{ {
if ( isOpen() ) { if ( isOpen() ) {
close(); close();
@ -139,7 +139,7 @@ TcpSocket :: strip ( void) throw ( Exception )
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Copy Constructor * Copy Constructor
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
TcpSocket :: TcpSocket ( const TcpSocket & ss ) throw ( Exception ) NetSocket :: NetSocket ( const NetSocket & ss ) throw ( Exception )
: Source( ss), Sink( ss ) : Source( ss), Sink( ss )
{ {
int fd; int fd;
@ -158,8 +158,8 @@ TcpSocket :: TcpSocket ( const TcpSocket & ss ) throw ( Exception )
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Assignment operator * Assignment operator
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
TcpSocket & NetSocket &
TcpSocket :: operator= ( const TcpSocket & ss ) throw ( Exception ) NetSocket :: operator= ( const NetSocket & ss ) throw ( Exception )
{ {
if ( this != &ss ) { if ( this != &ss ) {
int fd; int fd;
@ -190,7 +190,7 @@ TcpSocket :: operator= ( const TcpSocket & ss ) throw ( Exception )
* Open the file * Open the file
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
bool bool
TcpSocket :: open ( void ) throw ( Exception ) NetSocket :: open ( void ) throw ( Exception )
{ {
int optval; int optval;
socklen_t optlen; socklen_t optlen;
@ -259,7 +259,7 @@ TcpSocket :: open ( void ) throw ( Exception )
* Check wether read() would return anything * Check wether read() would return anything
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
bool bool
TcpSocket :: canRead ( unsigned int sec, NetSocket :: canRead ( unsigned int sec,
unsigned int usec ) throw ( Exception ) unsigned int usec ) throw ( Exception )
{ {
fd_set fdset; fd_set fdset;
@ -297,7 +297,7 @@ TcpSocket :: canRead ( unsigned int sec,
* Read from the socket * Read from the socket
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
unsigned int unsigned int
TcpSocket :: read ( void * buf, NetSocket :: read ( void * buf,
unsigned int len ) throw ( Exception ) unsigned int len ) throw ( Exception )
{ {
int ret; int ret;
@ -332,7 +332,7 @@ TcpSocket :: read ( void * buf,
* Check wether read() would return anything * Check wether read() would return anything
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
bool bool
TcpSocket :: canWrite ( unsigned int sec, NetSocket :: canWrite ( unsigned int sec,
unsigned int usec ) throw ( Exception ) unsigned int usec ) throw ( Exception )
{ {
fd_set fdset; fd_set fdset;
@ -370,7 +370,7 @@ TcpSocket :: canWrite ( unsigned int sec,
* Write to the socket * Write to the socket
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
unsigned int unsigned int
TcpSocket :: write ( const void * buf, NetSocket :: write ( const void * buf,
unsigned int len ) throw ( Exception ) unsigned int len ) throw ( Exception )
{ {
int ret; int ret;
@ -403,7 +403,7 @@ TcpSocket :: write ( const void * buf,
* Close the socket * Close the socket
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
void void
TcpSocket :: close ( void ) throw ( Exception ) NetSocket :: close ( void ) throw ( Exception )
{ {
if ( !isOpen() ) { if ( !isOpen() ) {
return; return;

View File

@ -4,7 +4,7 @@
Tyrell DarkIce Tyrell DarkIce
File : TcpSocket.h File : NetSocket.h
Version : $Revision$ Version : $Revision$
Author : $Author$ Author : $Author$
Location : $HeadURL$ Location : $HeadURL$
@ -55,7 +55,7 @@
* @author $Author$ * @author $Author$
* @version $Revision$ * @version $Revision$
*/ */
class TcpSocket : public Source, public Sink, public virtual Reporter class NetSocket : public Source, public Sink, public virtual Reporter
{ {
private: private:
@ -102,7 +102,7 @@ class TcpSocket : public Source, public Sink, public virtual Reporter
* @exception Exception * @exception Exception
*/ */
inline inline
TcpSocket ( void ) throw ( Exception ) NetSocket ( void ) throw ( Exception )
{ {
throw Exception( __FILE__, __LINE__); throw Exception( __FILE__, __LINE__);
} }
@ -118,7 +118,7 @@ class TcpSocket : public Source, public Sink, public virtual Reporter
* @exception Exception * @exception Exception
*/ */
inline inline
TcpSocket( const char * host, NetSocket( const char * host,
unsigned short port ) throw ( Exception ) unsigned short port ) throw ( Exception )
{ {
init( host, port); init( host, port);
@ -127,10 +127,10 @@ class TcpSocket : public Source, public Sink, public virtual Reporter
/** /**
* Copy constructor. * Copy constructor.
* *
* @param ss the TcpSocket to copy. * @param ss the NetSocket to copy.
* @exception Exception * @exception Exception
*/ */
TcpSocket( const TcpSocket & ss ) throw ( Exception ); NetSocket( const NetSocket & ss ) throw ( Exception );
/** /**
* Destructor. * Destructor.
@ -138,7 +138,7 @@ class TcpSocket : public Source, public Sink, public virtual Reporter
* @exception Exception * @exception Exception
*/ */
inline virtual inline virtual
~TcpSocket( void ) throw ( Exception ) ~NetSocket( void ) throw ( Exception )
{ {
strip(); strip();
} }
@ -146,12 +146,12 @@ class TcpSocket : public Source, public Sink, public virtual Reporter
/** /**
* Assignment operator. * Assignment operator.
* *
* @param ss the TcpSocket to assign this to. * @param ss the NetSocket to assign this to.
* @return a reference to this TcpSocket. * @return a reference to this NetSocket.
* @exception Exception * @exception Exception
*/ */
inline virtual TcpSocket & inline virtual NetSocket &
operator= ( const TcpSocket & ss ) throw ( Exception ); operator= ( const NetSocket & ss ) throw ( Exception );
/** /**
* Get the host this socket connects to. * Get the host this socket connects to.
@ -176,7 +176,7 @@ class TcpSocket : public Source, public Sink, public virtual Reporter
} }
/** /**
* Open the TcpSocket. * Open the NetSocket.
* *
* @return true if opening was successfull, false otherwise. * @return true if opening was successfull, false otherwise.
* @exception Exception * @exception Exception
@ -185,9 +185,9 @@ class TcpSocket : public Source, public Sink, public virtual Reporter
open ( void ) throw ( Exception ); open ( void ) throw ( Exception );
/** /**
* Check if the TcpSocket is open. * Check if the NetSocket is open.
* *
* @return true if the TcpSocket is open, false otherwise. * @return true if the NetSocket is open, false otherwise.
*/ */
inline virtual bool inline virtual bool
isOpen ( void ) const throw () isOpen ( void ) const throw ()
@ -201,7 +201,7 @@ class TcpSocket : public Source, public Sink, public virtual Reporter
* *
* @param sec the maximum seconds to block. * @param sec the maximum seconds to block.
* @param usec micro seconds to block after the full seconds. * @param usec micro seconds to block after the full seconds.
* @return true if the TcpSocket is ready to be read from, * @return true if the NetSocket is ready to be read from,
* false otherwise. * false otherwise.
* @exception Exception * @exception Exception
*/ */
@ -210,7 +210,7 @@ class TcpSocket : public Source, public Sink, public virtual Reporter
unsigned int usec ) throw ( Exception ); unsigned int usec ) throw ( Exception );
/** /**
* Read from the TcpSocket. * Read from the NetSocket.
* *
* @param buf the buffer to read into. * @param buf the buffer to read into.
* @param len the number of bytes to read into buf * @param len the number of bytes to read into buf
@ -223,12 +223,12 @@ class TcpSocket : public Source, public Sink, public virtual Reporter
/** /**
* Check if the TcpSocket is ready to accept data. * Check if the NetSocket is ready to accept data.
* Blocks until the specified time for data to be available. * Blocks until the specified time for data to be available.
* *
* @param sec the maximum seconds to block. * @param sec the maximum seconds to block.
* @param usec micro seconds to block after the full seconds. * @param usec micro seconds to block after the full seconds.
* @return true if the TcpSocket is ready to accept data, * @return true if the NetSocket is ready to accept data,
* false otherwise. * false otherwise.
* @exception Exception * @exception Exception
*/ */
@ -237,7 +237,7 @@ class TcpSocket : public Source, public Sink, public virtual Reporter
unsigned int usec ) throw ( Exception ); unsigned int usec ) throw ( Exception );
/** /**
* Write data to the TcpSocket. * Write data to the NetSocket.
* *
* @param buf the data to write. * @param buf the data to write.
* @param len number of bytes to write from buf. * @param len number of bytes to write from buf.
@ -249,7 +249,7 @@ class TcpSocket : public Source, public Sink, public virtual Reporter
unsigned int len ) throw ( Exception ); unsigned int len ) throw ( Exception );
/** /**
* Flush all data that was written to the TcpSocket to the underlying * Flush all data that was written to the NetSocket to the underlying
* connection. * connection.
* *
* @exception Exception * @exception Exception
@ -264,7 +264,7 @@ class TcpSocket : public Source, public Sink, public virtual Reporter
* This usually means separating the data sent to the sink up * This usually means separating the data sent to the sink up
* until now, and start saving a new chunk of data. * until now, and start saving a new chunk of data.
* *
* For TcpSocket, this is a no-op. * For NetSocket, this is a no-op.
*/ */
inline virtual void inline virtual void
cut ( void ) throw () cut ( void ) throw ()
@ -272,7 +272,7 @@ class TcpSocket : public Source, public Sink, public virtual Reporter
} }
/** /**
* Close the TcpSocket. * Close the NetSocket.
* *
* @exception Exception * @exception Exception
*/ */

View File

@ -37,7 +37,7 @@
/* ============================================================ include files */ /* ============================================================ include files */
#include "Sink.h" #include "Sink.h"
#include "TcpSocket.h" #include "NetSocket.h"
#include "CastSink.h" #include "CastSink.h"
@ -151,7 +151,7 @@ class ShoutCast : public CastSink
* @exception Exception * @exception Exception
*/ */
inline inline
ShoutCast ( TcpSocket * socket, ShoutCast ( NetSocket * socket,
const char * password, const char * password,
const char * mountPoint, const char * mountPoint,
unsigned int bitRate, unsigned int bitRate,