Commit 4a88983e authored by Marc Ariberti's avatar Marc Ariberti

* now it compiles with gcc 3.2 (c++ sucks)

parent f1f71ffc
......@@ -2,7 +2,8 @@
# vlcs (VideoLAN Channel Server) main Makefile - (c)2001 VideoLAN
###############################################################################
VERSION=0.2.0
VERSION=0.2.0b
#CC=g++-3.2
CC=c++
CFLAGS=-O3 -g -I. -Wall
......
......@@ -2,7 +2,7 @@
* config.c: mini-VideoLAN Channel Server, configuration system
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: config.c,v 1.6 2002/10/12 19:45:31 marcari Exp $
* $Id: config.c,v 1.7 2002/10/28 17:38:30 marcari Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Marc Ariberti <marcari@via.ecp.fr>
......@@ -38,6 +38,10 @@
#include <arpa/inet.h>
#include <signal.h>
#include <time.h>
#include <list>
#include <iostream>
#include <fstream>
#include <string>
#include "vlcs.h"
#include "logger.h"
......
......@@ -2,7 +2,7 @@
* logger.c: VideoLAN Channel Server logging facility
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: logger.c,v 1.5 2002/10/12 19:45:31 marcari Exp $
* $Id: logger.c,v 1.6 2002/10/28 17:38:30 marcari Exp $
*
* Authors: Marc Ariberti <marcari@via.ecp.fr>
*
......@@ -29,12 +29,16 @@
#include <syslog.h>
#include <errno.h>
#include <time.h>
#include <list>
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include "vlcs.h"
#include "logger.h"
C_Logger::~C_Logger()
{
}
......@@ -61,7 +65,7 @@ void C_ChainedLogger::Remove(C_Logger * logger)
C_Logger &C_ChainedLogger::operator<<(const char * msg)
{
for(list<C_Logger *>::iterator from = logger_list.begin();
for(std::list<C_Logger *>::iterator from = logger_list.begin();
from != logger_list.end() ; ++from)
{
(**from) << msg;
......@@ -72,7 +76,7 @@ C_Logger &C_ChainedLogger::operator<<(const char * msg)
C_Logger &C_ChainedLogger::operator<<(int value)
{
for(list<C_Logger *>::iterator from = logger_list.begin();
for(std::list<C_Logger *>::iterator from = logger_list.begin();
from != logger_list.end() ; ++from)
{
(**from) << value;
......@@ -83,7 +87,7 @@ C_Logger &C_ChainedLogger::operator<<(int value)
C_Logger &C_ChainedLogger::operator<<(log_command value)
{
for(list<C_Logger *>::iterator from = logger_list.begin();
for(std::list<C_Logger *>::iterator from = logger_list.begin();
from != logger_list.end() ; ++from)
{
(**from) << value;
......@@ -93,14 +97,14 @@ C_Logger &C_ChainedLogger::operator<<(log_command value)
}
/* file logger */
/*
C_FileLogger::C_FileLogger(int fd, logging_color color)
: log_file(fd), m_color(color)
{
}
}*/
C_FileLogger::C_FileLogger(const char * filename, logging_color color)
: log_file(filename, ios::app), m_color(color)
: log_file(filename, std::ios::app), m_color(color)
{
}
......@@ -165,7 +169,7 @@ C_Logger &C_FileLogger::operator<<(log_command value)
{
log_file << "\033[0m";
}
log_file << endl;
log_file << std::endl;
}
return *this;
......@@ -173,7 +177,7 @@ C_Logger &C_FileLogger::operator<<(log_command value)
/* Standard logger */
C_StdLogger::C_StdLogger(logging_color color)
: C_FileLogger(STDERR_FILENO, color)
: C_FileLogger("/dev/stderr", color)
{
}
......@@ -201,7 +205,7 @@ C_Logger &C_SysLogger::operator<<(const char * msg)
C_Logger &C_SysLogger::operator<<(int value)
{
ostringstream o;
std::ostringstream o;
o << value;
buffer += o.str();
......@@ -239,4 +243,3 @@ C_Logger &C_SysLogger::operator<<(log_command value)
return *this;
}
......@@ -2,7 +2,7 @@
* logger.h: VideoLAN Channel Server logging facility
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: logger.h,v 1.5 2002/10/12 19:45:31 marcari Exp $
* $Id: logger.h,v 1.6 2002/10/28 17:38:30 marcari Exp $
*
* Authors: Marc Ariberti <marcari@via.ecp.fr>
*
......@@ -21,10 +21,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <list>
#include <iostream>
#include <fstream>
#include <string>
class C_Logger
{
......@@ -50,7 +46,7 @@ public:
void Add(C_Logger * logger);
void Remove(C_Logger * logger);
protected:
list<C_Logger *> logger_list;
std::list<C_Logger *> logger_list;
};
class C_SysLogger : public C_Logger
......@@ -63,7 +59,7 @@ public:
virtual C_Logger &operator<<(log_command value);
protected:
string buffer;
std::string buffer;
int level;
};
......@@ -72,7 +68,7 @@ class C_FileLogger : public C_Logger
public:
typedef enum { NO_COLOR, LINUX } logging_color;
C_FileLogger(int fd, logging_color color = NO_COLOR);
// C_FileLogger(int fd, logging_color color = NO_COLOR);
C_FileLogger(const char * filename, logging_color color = NO_COLOR);
virtual ~C_FileLogger( void );
......@@ -81,7 +77,7 @@ public:
virtual C_Logger &operator<<(log_command value);
protected:
ofstream log_file;
std::ofstream log_file;
logging_color m_color;
};
......
......@@ -2,7 +2,7 @@
* socket.c: VideoLAN Channel Server network facilities
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: socket.c,v 1.6 2002/10/12 19:45:31 marcari Exp $
* $Id: socket.c,v 1.7 2002/10/28 17:38:30 marcari Exp $
*
* Authors: Marc Ariberti <marcari@via.ecp.fr>
*
......@@ -29,8 +29,11 @@
#include <errno.h>
#include <string.h>
#include <time.h>
#include <iostream>
#include <list>
#include <iostream>
#include <fstream>
#include <string>
#include "vlcs.h"
#include "logger.h"
#include "config.h"
......@@ -49,7 +52,7 @@ void C_Socket::Close( int i_ret )
* C_IPv4Socket class implementation
*/
C_IPv4Socket::C_IPv4Socket(C_Logger &logger, int port, char * bind_addr = NULL)
C_IPv4Socket::C_IPv4Socket(C_Logger &logger, int port, char * bind_addr )
throw (int) : C_Socket(logger)
{
int i_opt;
......@@ -136,7 +139,7 @@ const char * C_IPv4Socket::Ntop( void )
* C_IPv6Socket class implementation
*/
C_IPv6Socket::C_IPv6Socket(C_Logger &logger, int port, char * bind_addr = NULL)
C_IPv6Socket::C_IPv6Socket(C_Logger &logger, int port, char * bind_addr )
throw (int) : C_Socket(logger)
{
int i_opt;
......@@ -168,7 +171,8 @@ C_IPv6Socket::C_IPv6Socket(C_Logger &logger, int port, char * bind_addr = NULL)
if ( bind_addr != NULL )
{
inet_pton(AF_INET6, bind_addr, &s_bind_addr);
sa_server.sin6_addr.s6_addr = s_bind_addr.s6_addr;
memcpy(sa_server.sin6_addr.s6_addr, s_bind_addr.s6_addr,
sizeof(s_bind_addr.s6_addr));
}
else
{
......
......@@ -2,7 +2,7 @@
* vlcs.c: mini-VideoLAN Channel Server
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: vlcs.c,v 1.16 2002/10/12 19:45:31 marcari Exp $
* $Id: vlcs.c,v 1.17 2002/10/28 17:38:30 marcari Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Marc Ariberti <marcari@via.ecp.fr>
......@@ -22,7 +22,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <iostream>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
......@@ -40,6 +39,10 @@
#include <signal.h>
#include <time.h>
#include <getopt.h>
#include <iostream>
#include <list>
#include <fstream>
#include <string>
#include "vlcs.h"
#include "logger.h"
......@@ -152,14 +155,14 @@ void Loop( C_Logger &logger ) throw (int)
&i_time, psz_macad ) != 4 )
{
ip_socket->Reply( "E: Bad request" );
logger << C_Logger::ERROR << "sscanf failed : " << p_buffer;
logger << C_Logger::ERROR << "sscanf failed : " << p_buffer << C_Logger::END;
return;
}
if ( i_version < 13 )
{
ip_socket->Reply( "E: Version mismatch, please upgrade your software" );
logger << C_Logger::ALERT << "Break-in attempt ! " << ip_socket->Ntop();
logger << C_Logger::ALERT << "Break-in attempt ! " << ip_socket->Ntop() << C_Logger::END;
return;
}
......@@ -168,14 +171,14 @@ void Loop( C_Logger &logger ) throw (int)
i_channel >= config->GetChannelNumber() )
{
ip_socket->Reply( "E: Channel doesn't exist" );
logger << C_Logger::ERROR << "Bad channel : " << psz_channel;
logger << C_Logger::ERROR << "Bad channel : " << psz_channel << C_Logger::END;
return;
}
p_channel = config->GetChannel( i_channel );
if( p_channel == NULL )
{
logger << C_Logger::ERROR << "Bad channel : " << psz_channel;
logger << C_Logger::ERROR << "Bad channel : " << psz_channel << C_Logger::END;
ip_socket->Reply( "E: Channel doesn't exist" );
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment