diff --git a/testers/build.sh b/testers/build.sh index ce1b16a..96e0d4e 100755 --- a/testers/build.sh +++ b/testers/build.sh @@ -1,9 +1,8 @@ #!/bin/bash -#TRLIBS="-ltrbase -ltrhashing -ltrio -ltrdata -ltrevent -ltrcomm" -TRLIBS="/usr/local/lib/libtrcomm.a /usr/local/lib/libtrevent.a /usr/local/lib/libtrdata.a /usr/local/lib/libtrio.a /usr/local/lib/libtrhashing.a /usr/local/lib/libtrbase.a" +TRLIBS="-ltrbase -ltrhashing -ltrio -ltrdata -ltrevent -ltrcomm" +#TRLIBS="/usr/local/lib/libtrcomm.a /usr/local/lib/libtrevent.a /usr/local/lib/libtrdata.a /usr/local/lib/libtrio.a /usr/local/lib/libtrhashing.a /usr/local/lib/libtrbase.a" LIBS="-lcrypto -lssl -lrt -luuid" gcc ${CFLAGS} -std=c99 -c -o test_handler.o test_handler.c -gcc ${CFLAGS} -std=c99 -I/usr/local/include -L/usr/local/lib ${LIBS} -o testserver testserver.c test_handler.o ${TRLIBS} gcc ${CFLAGS} -std=c99 -I/usr/local/include -L/usr/local/lib ${LIBS} -o testserver2 testserver2.c test_handler.o ${TRLIBS} gcc ${CFLAGS} -std=c99 -I/usr/local/include -L/usr/local/lib ${LIBS} -o testtcp testclient.c ${TRLIBS} gcc ${CFLAGS} -std=c99 -I/usr/local/include -L/usr/local/lib ${LIBS} -DUDP=1 -o testudp testclient.c ${TRLIBS} diff --git a/testers/testserver.c b/testers/testserver.c deleted file mode 100644 index daca046..0000000 --- a/testers/testserver.c +++ /dev/null @@ -1,76 +0,0 @@ -#include -#include -#include - -#include "trbase.h" -#include "trcomm.h" -#include "trevent.h" - -#include "test_handler.h" - -TR_INSTANCE(TR_LoggerSyslog, mylogger, {TR_LOGGER_DEBUG}); - -int -main (int argc, char * argv[]) -{ - TR_CommManager cmgr = (TR_CommManager)TR_new(TR_CommManagerPoll); - TR_EventDispatcher dispatcher = TR_new(TR_EventDispatcher); - TR_Connector connector = TR_new(TR_Connector); - TR_IoHandler io_handler = TR_new(TR_IoHandler); - TR_ProtocolHandler protocol_handler = TR_new(TR_ProtocolHandler); - TestHandler test_handler = TR_new(TestHandler); - TR_ConnEntryPoint tcp_ep; - TR_TcpSocket tcp_ep_sock; - TR_DatagramService udp_ep; - TR_UdpSocket udp_ep_sock; - TR_Protocol protocol; - - TR_logger = TR_INSTANCE_CAST(TR_Logger, mylogger); - - TR_eventDispatcherRegisterHandler(dispatcher, (TR_EventHandler)cmgr); - TR_eventDispatcherRegisterHandler(dispatcher, (TR_EventHandler)connector); - TR_eventDispatcherRegisterHandler(dispatcher, (TR_EventHandler)io_handler); - TR_eventDispatcherRegisterHandler( - dispatcher, - (TR_EventHandler)protocol_handler); - TR_eventDispatcherRegisterHandler( - dispatcher, - (TR_EventHandler)test_handler); - - protocol = TR_new(TR_ProtocolRaw); - tcp_ep_sock = TR_new(TR_TcpSocket, TR_logger, "0.0.0.0", 5678, 0); - tcp_ep = TR_new(TR_ConnEntryPoint, tcp_ep_sock, protocol); - udp_ep_sock = TR_new(TR_UdpSocket, TR_logger, "0.0.0.0", 5678, 0); - TR_socketBind((TR_Socket)udp_ep_sock); - TR_socketNonblock((TR_Socket)udp_ep_sock); - udp_ep = TR_new(TR_DatagramService, udp_ep_sock, protocol); - - TR_commManagerAddEndpoint(cmgr, (TR_CommEndPoint)tcp_ep); - TR_commManagerAddEndpoint(cmgr, (TR_CommEndPoint)udp_ep); - - TR_eventDispatcherSetHeartbeat(dispatcher, 1000); - TR_eventDispatcherStart(dispatcher); - - puts("cleanup..."); - - TR_delete(cmgr); - TR_delete(dispatcher); - TR_delete(connector); - TR_delete(io_handler); - TR_delete(protocol_handler); - TR_delete(test_handler); - TR_delete(protocol); - //TR_delete(ep); - - TR_eventHandlerClassCleanup(TestHandler); - TR_eventHandlerClassCleanup(TR_ProtocolHandler); - TR_eventHandlerClassCleanup(TR_IoHandler); - TR_eventHandlerClassCleanup(TR_Connector); - TR_eventHandlerClassCleanup(TR_CommManagerPoll); - - TR_cleanup(); - - return 0; -} - -// vim: set ts=4 sw=4: