|
From: <den...@us...> - 2010-07-29 13:56:01
|
Revision: 118
http://dsim.svn.sourceforge.net/dsim/?rev=118&view=rev
Author: denis_arnaud
Date: 2010-07-29 13:55:55 +0000 (Thu, 29 Jul 2010)
Log Message:
-----------
[Alpha dev] Comestic changes in the Boost.ASIO log server.
Modified Paths:
--------------
trunk/dsim/test/boost/asio/log_server/Makefile.am
trunk/dsim/test/boost/asio/log_server/networkFunctions.cpp
trunk/dsim/test/boost/asio/log_server/networkFunctions.hpp
trunk/dsim/test/boost/asio/log_server/tinyLog.cpp
trunk/dsim/test/boost/asio/log_server/tinyLog.hpp
Property Changed:
----------------
trunk/dsim/test/boost/asio/log_server/
Property changes on: trunk/dsim/test/boost/asio/log_server
___________________________________________________________________
Modified: svn:ignore
- .deps
.libs
Makefile.in
Makefile
client
server
server.log
+ .deps
.libs
Makefile.in
Makefile
client
server
server.log
synServer
asynServer
Modified: trunk/dsim/test/boost/asio/log_server/Makefile.am
===================================================================
--- trunk/dsim/test/boost/asio/log_server/Makefile.am 2010-07-29 12:06:21 UTC (rev 117)
+++ trunk/dsim/test/boost/asio/log_server/Makefile.am 2010-07-29 13:55:55 UTC (rev 118)
@@ -7,7 +7,7 @@
check_PROGRAMS = client synServer asynServer
-client_SOURCES = client.cpp
+client_SOURCES = client.cpp networkFunctions.cpp
client_CXXFLAGS = $(BOOST_CFLAGS) $(BOOST_CFLAGS)
client_LDFLAGS = $(BOOST_LIBS) $(BOOST_DATE_TIME_LIB) $(BOOST_ASIO_LIB)
client_LDADD =
Modified: trunk/dsim/test/boost/asio/log_server/networkFunctions.cpp
===================================================================
--- trunk/dsim/test/boost/asio/log_server/networkFunctions.cpp 2010-07-29 12:06:21 UTC (rev 117)
+++ trunk/dsim/test/boost/asio/log_server/networkFunctions.cpp 2010-07-29 13:55:55 UTC (rev 118)
@@ -1,19 +1,27 @@
+// STL
+#include <iostream>
+#include <string>
+//
+#include <netdb.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+//
#include "networkFunctions.hpp"
-int service_to_port(std::string s){
+int service_to_port (const std::string& s) {
servent* a = getservbyname(s.c_str(), NULL);
endservent();
- if (a!= NULL)
+ if (a!= NULL) {
return htons(a -> s_port);
- else{
+ } else {
std::cout << "No service with name:" << s << " is found" << std::endl;
return -1;
}
}
-std::string port_to_service(int p){
+std::string port_to_service (const int p){
servent* a = getservbyport(htons(p), NULL);
endservent();
@@ -25,7 +33,7 @@
}
}
-std::string ip_to_hostname(std::string s){
+std::string ip_to_hostname (const std::string& s){
struct hostent *he;
struct in_addr ipv4addr;
inet_pton(AF_INET, s.c_str(), &ipv4addr);
@@ -47,4 +55,4 @@
// string add="173.163.134.217";
// std::cout << ip_to_hostname(add) << std::endl;
// return 0;
-// }
\ No newline at end of file
+// }
Modified: trunk/dsim/test/boost/asio/log_server/networkFunctions.hpp
===================================================================
--- trunk/dsim/test/boost/asio/log_server/networkFunctions.hpp 2010-07-29 12:06:21 UTC (rev 117)
+++ trunk/dsim/test/boost/asio/log_server/networkFunctions.hpp 2010-07-29 13:55:55 UTC (rev 118)
@@ -1,28 +1,25 @@
-#ifndef __NETWORKFUNCTIONS__
-#define __NETWORKFUNCTIONS__
+#ifndef __DSIM_NETWORKFUNCTIONS__
+#define __DSIM_NETWORKFUNCTIONS__
-#include <iostream>
-#include <string>
+/**
+ * \brief Return the port corresponding to service name s using /etc/services
+ * <br>For ex: aria returns 2624
+ */
+int service_to_port (const std::string&);
-#include <netdb.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-/* return the port corresponding to service name s using /etc/services
-* For ex: aria returns 2624
-*/
-int service_to_port(std::string s);
+/**
+ * \brief contrary of service_to_port
+ * <br>ex: 22 -> ssh
+ */
+std::string port_to_service (const int p);
+/**
+ * \brief Ex: Takes 172.16.134.217 , returns nceorilnx03.nce.amadeus.net
+ */
+std::string ip_to_hostname (const std::string& s);
-/* contrary of service_to_port
-* ex: 22 -> ssh
-*/
-std::string port_to_service(int p);
-/* Ex: Takes 172.16.134.217 , returns nceorilnx03.nce.amadeus.net*/
-std::string ip_to_hostname(std::string s);
-
-
-#endif
\ No newline at end of file
+#endif // __DSIM_NETWORKFUNCTIONS__
Modified: trunk/dsim/test/boost/asio/log_server/tinyLog.cpp
===================================================================
--- trunk/dsim/test/boost/asio/log_server/tinyLog.cpp 2010-07-29 12:06:21 UTC (rev 117)
+++ trunk/dsim/test/boost/asio/log_server/tinyLog.cpp 2010-07-29 13:55:55 UTC (rev 118)
@@ -1,8 +1,19 @@
+
+// String, stream functions
+#include <string>
+#include <fstream>
+// Boost.ASIO
+#include <boost/asio.hpp>
+#include <boost/array.hpp>
+// Sleep funtion
+#include <unistd.h>
+//Some network functions
+#include "networkFunctions.cpp"
+//
#include "tinyLog.hpp"
-
-
-void send_file (std::string lServerName, int lServerPort, std::string filename){
+void send_file (const std::string& lServerName, const int lServerPort,
+ const std::string& filename) {
using namespace std;
int attempt=0; //Nb of attemps to connect to server
// testing if file exists
@@ -66,8 +77,8 @@
}
}
-
-void send_string(std::string lServerName, int lServerPort, std::string buffer){
+void send_string (const std::string& lServerName, const int lServerPort,
+ const std::string& buffer) {
using namespace std;
int attempt=0; //Nb of attemps to connect to server
Modified: trunk/dsim/test/boost/asio/log_server/tinyLog.hpp
===================================================================
--- trunk/dsim/test/boost/asio/log_server/tinyLog.hpp 2010-07-29 12:06:21 UTC (rev 117)
+++ trunk/dsim/test/boost/asio/log_server/tinyLog.hpp 2010-07-29 13:55:55 UTC (rev 118)
@@ -1,31 +1,26 @@
-#ifndef __TINYLOG__
-#define __TINYLOG__
+#ifndef __DSIM_TINYLOG__
+#define __DSIM_TINYLOG__
// String, stream functions
-#include <iostream>
#include <string>
-#include <fstream>
-// Boost.ASIO
-#include <boost/asio.hpp>
-#include <boost/array.hpp>
-// Sleep funtion
-#include <unistd.h>
-//Some network functions
-#include "networkFunctions.cpp"
-/* Send filename's content to server
-* lServerName: name of server,ex: localhost
-* lServerPort: listening port on server
-* filename: file to send to server
+/**
+ * \brief Send filename's content to server
+ * \param[in] lServerName: name of server,ex: localhost
+ * \param[in] lServerPort: listening port on server
+ * \param[in] filename: file to send to server
*/
-void send_file (std::string lServerName, int lServerPort, std::string filename);
+void send_file (const std::string& lServerName, const int lServerPort,
+ const std::string& filename);
-/* Send string buffer to server
-* lServerName: name of server,ex: localhost
-* lServerPort: listening port on server
-* filename: file to send to server
+/**
+ * \brief Send string buffer to server
+ * \param[in] lServerName: name of server,ex: localhost
+ * \param[in] lServerPort: listening port on server
+ * \param[in] filename: file to send to server
*/
-void send_string(std::string lServerName, int lServerPort, std::string buffer);
+void send_string (const std::string& lServerName, const int lServerPort,
+ const std::string& buffer);
-#endif
\ No newline at end of file
+#endif // __DSIM_TINYLOG__
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|