Commit ad7fd0db authored by Michel Kaempf's avatar Michel Kaempf
Browse files

* CVS Creation

-- MaXX
parent a1962d3d
#
# Dmalloc run-time configuration file for the debug malloc library
#
# no debugging
none none
# basic debugging
debug1 log-stats, log-non-free, check-fence
# more logging and some heap checking
debug2 log-stats, log-non-free, log-trans,
check-fence, check-heap, check-lists, error-abort
# good utilities
debug3 log-stats, log-non-free, log-trans,
log-admin, check-fence, check-heap, check-lists, realloc-copy,
free-blank, error-abort
################################################################################
# vls core Makefile
# (c)1998 VideoLAN
################################################################################
################################################################################
# Settings
################################################################################
#
# C++ compiler must be used
#
CC = g++
#
# C compiler flags: dependancies
#
DCFLAGS += -Wall
DCFLAGS += -MM
#
# C compiler flags: compilation
#
CCFLAGS += -Wall
#CCFLAGS += -fexternal-templates
CCFLAGS += -DREENTRANT
#CCFLAGS += -O8
#
# C compiler flags: linking
#
LCFLAGS += -Wall
#
# Headers paths
#
INCLUDE += -Icore/
INCLUDE += -Iserver/
INCLUDE += -Iserver/satellite/
INCLUDE += -Iserver/vod/
INCLUDE += -I-
#
# Needed libraries
#
LIB += -lpthread
LIB += /usr/lib/libstdc++.so.2.8.0
LIB += lib/libamsapi.a
LIB += lib/libnspr3.so
#
# Debugging and profiling
#
CCFLAGS += -g
#CCFLAGS += -pg
#CCFLAGS += -g -pg
#LIB += -ldmalloc
#LIB += -lefence
#################################################################################
# Files desription
#################################################################################
#
# Source files
#
SRC = server/admin.cpp \
server/application.cpp \
server/buffer.cpp \
server/directory.cpp \
server/input.cpp \
server/main.cpp \
server/manager.cpp \
server/output.cpp \
server/ts.cpp \
server/satellite/satellite.cpp \
server/vod/vod.cpp \
core/cfgfile.cpp \
core/log.cpp \
core/string.cpp \
core/thread.cpp
#
# Object files
#
OBJ := $(SRC:%.cpp=obj/%.o)
#
# Dependancies
#
DEP := $(SRC:%.cpp=dep/%.d)
################################################################################
# Targets definition
################################################################################
#
# Build rules
#
all: vls
clean:
rm -Rf obj/*
distclean: clean
rm -f vls
rm -Rf dep/*
rm -Rf *.log *.dbg
dep: $(DEP)
vls: $(OBJ)
@echo "Linking $@..."
$(CC) -o $@ $(OBJ) $(CFLAGS) $(LCFLAGS) $(LIB)
chmod 755 $@
$(OBJ): obj/%.o: dep/%.d
$(OBJ): obj/%.o: %.cpp
@test -d obj/$(dir $*) || mkdir -p obj/$(dir $*)
@echo "Compiling $<..."
$(CC) $(CFLAGS) $(CCFLAGS) $(INCLUDE) -o $@ -c $<
$(DEP): Makefile
$(DEP): dep/%.d: %.cpp
@test -d dep/$(dir $*) || mkdir -p dep/$(dir $*)
@echo "Generating dependancies for $<..."
@$(SHELL) -ec '$(CC) $(CFLAGS) $(DCFLAGS) $(INCLUDE) $< \
| sed '\''s/$(subst .,\.,$(notdir $*))\.o[ :]*/$(subst /,\/,$*).o \
dep\/$(subst /,\/,$*).d : /g'\'' > $@; \
[ -s $@ ] || rm -f $@'
#
# Dependancies inclusion
#
include $(DEP)
################################################################################
# Notes
################################################################################
# The purpose of the sed command is to make each `.d' file depend on all the
# source and header files that the corresponding `.o' file depends on. make then
# knows it must regenerate the dependencies whenever any of the source or header
# files changes.
# Each .d file also depends on the Makefile so that make regenerate the entire
# files when the Makefile is modified
#
# Each .o file of course depends of all the headers it may include thanks to the
# automatic dependance computation.
# Is also depends on the corresponding .d file so that we are sure it will be
# remade each time the dependancies are updated even if the files it depends have
# not changed. This is usefull when the Makefile is modified for example.
#
# At that time, all dependancies are included. Howewer a .d file should only be
# included if the corresponding .o needs to be re-made. I don't know how to do
# without calling another makefile to build the .d files.
# Makefile for VideoLAN Video Server manager
# Benoit Steiner, VIA, ECP, <benny@via.ecp.fr>
############ Beginning of the configuration section ############
# Use the GNU C compiler
CC = gcc
# Use checker compiler
#CC = checkercc
# Compile debugging version
CFLAGS += -DDEBUG
# Debug with the debugger
CFLAGS += -g
# Profile with gprof. Don't strip the executable file !
#CFLAGS += -pg
# Compiler parameters style
CFLAGS += -Wall
#CFLAGS += -O6
#CFLAGS += -static
# To generate the dependencies
DFLAGS += -MM
SHELL = /bin/sh
# Use the GTK Toolkit
GTKFLAGS += `gtk-config --cflags`
GTKLIBS += `gtk-config --libs`
# Use threads
#CFLAGS += -D_REENTRANT
#LIB += -lpthread
# Use electric fence to detect illegal memory access
LIB += -lefence
# Use dmalloc to detect memory leaks
#LIB += -ldmalloc
# Use ccmalloc to check memory use
#LIB += -lccmalloc -ldl
#####################################################################################
OBJ = \
main.o
SRC := $(OBJ:%.o=%.c)
DEP := $(OBJ:%.o=dep/%.d)
#####################################################################################
vls: $(OBJ)
$(CC) -o $@ $(OBJ) $(LIB) $(GTKLIBS) $(LDFLAGS) $(CFLAGS)
chmod 755 $@
$(DEP): dep/%.d: %.c
@test -d dep/$(dir $*) || mkdir -p dep/$(dir $*)
@echo "Generating dependancies for $*.c"
@$(SHELL) -ec '$(CC) $(DFLAGS) $(CFLAGS) $< \
| sed '\''s/$(subst .,\.,$(notdir $*))\.o[ :]*/$(subst /,\/,$*).o \
dep\/$(subst /,\/,$*).d : /g'\'' > $@; \
[ -s $@ ] || rm -f $@'
$(OBJ): %.o: dep/%.d
$(OBJ): %.o: %.c
$(CC) $(CFLAGS) $(GTKFLAGS) -c -o $@ $<
main.o dep/main.d : main.c
#include <gtk/gtk.h>
int CreateControls();
int CreateInterface();
void DeleteEvent(GtkWidget *pwWidget, GdkEvent* peEvent, gpointer pData)
{
gtk_main_quit ();
}
void quit ()
{
gtk_exit (0);
}
int main(int argc, char* argv[])
{
GtkWidget* pwWindow;
// GtkWidget* pwButton;
/* Default setup of the GTK lib */
gtk_init(&argc, &argv);
/* Create a window widget */
pwWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
/* Sets the title of the window */
gtk_window_set_title(GTK_WINDOW(pwWindow), "VideoLAN Server Manager");
/* Quit ????????????????????????????? */
gtk_signal_connect(GTK_OBJECT(pwWindow), "delete_event",
GTK_SIGNAL_FUNC (DeleteEvent), NULL);
gtk_signal_connect(GTK_OBJECT(pwWindow), "destroy_event",
GTK_SIGNAL_FUNC (DeleteEvent), NULL);
gtk_signal_connect (GTK_OBJECT (pwWindow), "destroy",
GTK_SIGNAL_FUNC (quit), NULL);
/* Display it */
gtk_widget_show(pwWindow);
/* GTK main processing loop */
gtk_main();
return 0;
}
testbuffer: testbuffer.o log.o string.o buffer.o ts.o
g++ -g -Wall -o testbuffer testbuffer.o log.o string.o ts.o buffer.o -ldmalloc
testbuffer.o: testbuffer.c ../core/buffer.h
g++ -g -Wall -c testbuffer.c
log.o: ../core/log.cpp ../core/log.h
g++ -g -Wall -c ../core/log.cpp
string.o: ../core/string.cpp ../core/string.h
g++ -g -Wall -c ../core/string.cpp
ts.o: ../core/ts.cpp ../core/ts.h
g++ -g -Wall -c ../core/ts.cpp
buffer.o: ../core/buffer.cpp ../core/buffer.h
g++ -g -Wall -c ../core/buffer.cpp
testcfgfile: testcfgfile.o log.o string.o cfgfile.o ts.o
g++ -g -Wall -o testcfgfile testcfgfile.o log.o string.o ts.o cfgfile.o -ldmalloc
testcfgfile.o: testcfgfile.c ../core/cfgfile.h
g++ -g -Wall -c testcfgfile.c
log.o: ../core/log.cpp ../core/log.h
g++ -g -Wall -c ../core/log.cpp
string.o: ../core/string.cpp ../core/string.h
g++ -g -Wall -c ../core/string.cpp
ts.o: ../core/ts.cpp ../core/ts.h
g++ -g -Wall -c ../core/ts.cpp
cfgfile.o: ../core/cfgfile.cpp ../core/cfgfile.h
g++ -g -Wall -c ../core/cfgfile.cpp
testlog: testlog.o log.o string.o dmalloc.o
g++ -g -Wall -o testlog testlog.o log.o string.o dmalloc.o -ldmalloc
testlog.o: testlog.c ../core/log.h
g++ -g -Wall -c testlog.c
log.o: ../core/log.cpp ../core/log.h
g++ -g -Wall -c ../core/log.cpp
string.o: ../core/string.cpp ../core/string.h
g++ -g -Wall -c ../core/string.cpp
dmalloc.o: /usr/doc/dmalloc/c++/dmalloc.cc
g++ -g -Wall -c /usr/doc/dmalloc/c++/dmalloc.cc
teststring: teststring.o string.o
g++ -g -Wall -o teststring teststring.o string.o -ldmalloc
teststring.o: teststring.c ../core/string.h
g++ -g -Wall -c teststring.c
string.o: ../core/string.cpp ../core/string.h
g++ -g -Wall -c ../core/string.cpp
#Fichier de configuration pour le bridge
#La section Bridge ne sert a rien pour le moment
BEGIN Globals # Config generale du bridge
Port = 2000
Log = /home/benny/projet/VLANbridge/BRIDGELOG
END
BEGIN Interfaces # Config du performer
VLANcount = 16 # Nombre de VLANs
VLANdefault = 2 # VLAN par defaut
VLAN2 = eth0 # Mapping VLAN / If
# VLAN3 = eth1
# VLAN4 = eth2
# VLAN15 = eth2
# VLAN16 = eth3
END
BEGIN Router
IP = 138.195.136.1 # IP du router
MAC = 08:00:02:1A:3D:89 # MAC du router
END
BEGIN Hosts # Definitions des clients potentiels
Start = 138.195.136.2
End = 138.195.138.55
# Forbidden = 138.195.136.1
END
78: Dmalloc version '3.3.1'. UN-LICENSED copy.
78: dmalloc_logfile 'dmalloc.log': flags = 0x40005c7, addr = 0
78: starting time = 925597909
78: free bucket count/bits: 256/4 128/5 64/6 16/8
78: basic-block 4096 bytes, alignment 8 bytes, heap grows up
78: heap: 0x804d000 to 0x8054000, size 28672 bytes (7 blocks), checked 0
78: alloc calls: malloc 39, realloc 0, calloc 0, free 39
78: total memory allocated: 1116 bytes (39 pnts)
78: max in use at one time: 645 bytes (12 pnts)
78: max alloced with 1 call: 188 bytes
78: max alloc rounding loss: 251 bytes (28%)
78: max memory space wasted: 15488 bytes (94%)
78: final user memory space: basic 0, divided 4, 16384 bytes
78: final admin overhead: basic 1, divided 2, 12288 bytes (42%)
78: final external space: 0 bytes (0 blocks)
78: ending time = 925597910, elapsed since start = 0:0:1
#include <string.h>
#include <errno.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
int main()
{
int iSockFd;
int iSockOpts;
unsigned long inaddr;
struct sockaddr_in saSrc, saDst;
socklen_t iSrcLen, iDstLen;
saSrc.sin_family = AF_INET;
saSrc.sin_port = 8888;
inaddr = inet_addr("138.195.143.250"); /* Use eth1 to send packets */
memcpy(&saSrc.sin_addr, &inaddr, sizeof(inaddr));
iSrcLen = sizeof(saSrc);
saDst.sin_family = AF_INET;
saDst.sin_port = 9999;
inaddr = inet_addr("239.0.0.1"); /* Dst = all machines on the LAN */
memcpy(&saDst.sin_addr, &inaddr, sizeof(inaddr));
iDstLen = sizeof(saDst);
iSockFd = socket(AF_INET, SOCK_DGRAM, 0);
if (iSockFd < 0)
printf("Socket error: %s\n", strerror(errno));
iSockOpts = 1;
if (setsockopt(iSockFd, SOL_SOCKET, SO_BROADCAST, &iSockOpts,
sizeof(iSockOpts)) < 0)
printf("Setsockopt error: %s\n", strerror(errno));
if (setsockopt(iSockFd, SOL_SOCKET, SO_DONTROUTE, &iSockOpts,
sizeof(iSockOpts)) < 0)
printf("Setsockopt error: %s\n", strerror(errno));
if (bind(iSockFd, (struct sockaddr*)&saSrc, iSrcLen))
printf("Bind error: %s\n", strerror(errno));
if (connect(iSockFd, (struct sockaddr*)&saDst, iDstLen))
printf("Connect error: %s\n", strerror(errno));
if (send(iSockFd, "toto\n", 5, 0))
printf("Send error: %s\n", strerror(errno));
return 0;
}
// Test des fonctions de buffering
// A compiler par 'make -f Makefile.buffer'
#include <pthread.h>
#include <stdio.h>
#include "../core/config.h"
#include "../core/common.h"
#include "../core/debug.h"
#include "../core/string.h"
#include "../core/log.h"
#include "../core/ts.h"
#include "../core/buffer.h"
// Global logging endpoint
C_Log* pLog = NULL;
int main()
{
int iRc = 0;
// Application initialisation
handle hLog;
pLog = new C_Log();
printf("New log object created\n");
pLog->Init("Testbuffer.log");
printf("Log object initiated\n");
int iFlags = 0 | LOG_DBGMSG | LOG_SCR | LOG_FILE;
hLog = pLog->Register("TestLog", iFlags);
printf("Registered Testlog\n");
// Tests of the buffers
printf("!!!!!!!!!!!!!!!!!! BEGIN !!!!!!!!!!!!!!!!\n");
C_TsPacket Essai;
C_Fifo test(5);
while(!iRc)
{
iRc = test.Push(&Essai);
printf("Push ");
}
printf("\n");
C_TsPacket* pPacket = test.Pull();
iRc = test.Push(&Essai);
printf("%p %d\n", pPacket, iRc);
printf("!!!!!!!!!!!!!!!!!!! END !!!!!!!!!!!!!!!!!\n");
// Application termination
pLog->Unregister(hLog);
printf("TestLog unregistered\n");
pLog->End();
printf("Log ended\n");
delete pLog;
printf("Log deleted\n");
return 0;
}
// Test des fonctions de gestion des fichiers de config
// A compiler par 'make -f Makefile.cfgfile'
#include <pthread.h>
#include <stdio.h>
#include "../core/config.h"
#include "../core/common.h"
#include "../core/string.h"
#include "../core/log.h"
#include "../core/cfgfile.h"
#include "../core/debug.h"
// Global logging endpoint
C_Log* pLog = NULL;
int main()
{
int iRc = 0;
// Application initialisation
handle hLog;
pLog = new C_Log();
printf("New log object created\n");
pLog->Init("Testcfgfile.log");
printf("Log object initiated\n");
int iFlags = 0 | LOG_DBGMSG | LOG_SCR | LOG_FILE;
hLog = pLog->Register("TestLog", iFlags);
printf("Registered Testlog\n");
// Tests of the cfg file
printf("!!!!!!!!!!!!!!!!!! BEGIN !!!!!!!!!!!!!!!!\n");
C_CfgFile CfgFile(hLog);
CfgFile.Open("Test.conf");
CfgFile.FindSection("Globals");
C_String strVarName, strVarVal;
CfgFile.Read(&strVarName, &strVarVal);
strVarName.Display();
strVarVal.Display();
CfgFile.FindSection("Interfaces");
CfgFile.FindEntry("VLANdefault", &strVarVal);
strVarVal.Display();
CfgFile.Close();
printf("!!!!!!!!!!!!!!!!!!! END !!!!!!!!!!!!!!!!!\n");
// Application termination
pLog->Unregister(hLog);
printf("TestLog unregistered\n");
pLog->End();
printf("Log ended\n");
delete pLog;
printf("Log deleted\n");
return 0;
}
// Test des fonctions de log
// A compiler par 'make -f Makefile.log'
#include <pthread.h>
#include <stdio.h>
#include "../core/config.h"
#include "../core/common.h"
#include "../core/debug.h"
#include "../core/string.h"
#include "../core/log.h"
// Global logging endpoint
C_Log* pLog = NULL;
int main()
{
handle hLog;
pLog = new C_Log();
printf("New log object created\n");
pLog->Init("Testlog.log");
printf("Log object initiated\n");
int iFlags = 0 | LOG_DBGMSG | LOG_SCR | LOG_FILE;
hLog = pLog->Register("TestLog", iFlags);
printf("Registered Testlog\n");
Log(hLog, LOG_NOTE, "Test1: %d, %s, %p", 1, "toto", pLog);
Log(hLog, LOG_WARN, "Test2: %d, %s", 2, "coucou");
Log(hLog, LOG_ERROR, "Test3: %d, %s", 3, "lalalere");