00001
00002
00003
00004
00005
00006
00007
00008 #include <sys/types.h>
00009 #include <sys/stat.h>
00010 #include <fcntl.h>
00011 #include <unistd.h>
00012 #include <sys/socket.h>
00013 #include <netinet/in.h>
00014
00015 #include <netinet/tcp.h>
00016
00017 #include <arpa/inet.h>
00018 #include <netdb.h>
00019 #include <sys/select.h>
00020 #include <sys/time.h>
00021 #include <iostream>
00022
00023 #include "SysPlusPlus/syslib.h"
00024
00025
00026
00027
00028
00029 struct hostent * syspp::Lib::Gethostbyname ( std::string n ) {
00030 return gethostbyname ( n.c_str() ) ;
00031 }
00032
00033
00034
00035 struct hostent * syspp::Lib::Gethostbyname ( char * n ) {
00036
00037 return gethostbyname ( n ) ;
00038
00039 }
00040
00041
00042 syspp::uint32 syspp::Lib::Ntohl ( syspp::uint32 v ) {
00043
00044 return (syspp::uint32) ntohl ( (uint32_t) v );
00045
00046 }
00047
00048 syspp::uint32 syspp::Lib::Htonl ( syspp::uint32 v ) {
00049
00050 return (syspp::uint32) htonl ( (uint32_t) v);
00051
00052 }
00053
00054 syspp::uint16 syspp::Lib::Ntohs ( syspp::uint16 v ) {
00055
00056 return (syspp::uint16) ntohs ( (uint16_t)v ) ;
00057
00058 }
00059
00060 syspp::uint16 syspp::Lib::Htons ( syspp::uint16 v ) {
00061
00062 return (syspp::uint16) htons ( (uint16_t) v );
00063
00064 }
00065
00066
00067
00068
00069 #ifdef SPECIAL_DEBUG
00070
00071 int main (int argc, char *argv[]) {
00072
00073 syspp::uint32 t, t1, t2;
00074
00075 syspp::uint16 tt, tt1, tt2;
00076
00077 t= 67;
00078
00079 t1 = syspp::Lib::Htonl( t );
00080 t2 = syspp::Lib::Ntohl( t1 );
00081 std::cout << t << " " << t1 << " " << t2 << "\n";
00082
00083 tt = 89;
00084
00085 tt1 = syspp::Lib::Htonl( tt );
00086 tt2 = syspp::Lib::Ntohl( tt1 );
00087 std::cout << tt << " " << tt1 << " " << tt << "\n";
00088
00089
00090 }
00091
00092
00093
00094
00095
00096
00097
00098 #endif