X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=misc%2Fnetwork_servers%2Fvtl%2Fnet_util.cc;fp=misc%2Fnetwork_servers%2Fvtl%2Fnet_util.cc;h=7b352eee7c931fd89382205cad3bba0e530f4c3e;hp=0000000000000000000000000000000000000000;hb=ac93f0773f4c6cef2f2f542240695a8706037d41;hpb=c016bb46bd68474161e275a5ace086c3fb810d9f diff --git a/misc/network_servers/vtl/net_util.cc b/misc/network_servers/vtl/net_util.cc new file mode 100644 index 0000000..7b352ee --- /dev/null +++ b/misc/network_servers/vtl/net_util.cc @@ -0,0 +1,53 @@ +#include +#include + +#include "net_util.h" + + +void do_string_to_ipaddress(unsigned char * ip, IPADDRESS & ipaddress) { + +} + +unsigned long do_ipaddress_to_unsigned_long(IPADDRESS & ipaddress) { + return 0; +} + +// ip address conversion functions +void do_binary_to_ipaddress(unsigned char* ip,IPADDRESS& ipaddress) { + ipaddress.a1 = ip[0]; + ipaddress.a2 = ip[1]; + ipaddress.a3 = ip[2]; + ipaddress.a4 = ip[3]; +} + + +// ip address conversion functions +void do_binary_to_string(unsigned char* ip,char* buffer) { + IPADDRESS ipaddress; + do_binary_to_ipaddress(ip, ipaddress); + do_ipaddress_to_string(ipaddress, buffer); +} + +void do_ipaddress_to_string(IPADDRESS ipaddress, char* buffer) { + sprintf(buffer,"%d.%d.%d.%d", ipaddress.a1, ipaddress.a2, ipaddress.a3, ipaddress.a4); +} + +/* +// this function returns the ip protocol string based on the ip protocol number +char* return_ip_protocol(unsigned char protocol) { + + if(protocol == 0x1) { + return "ICMP"; + } else if(protocol == 0x6) { + return "TCP"; + } else if(protocol == 17) { + return "UDP"; + } else if(protocol == 121) { + return "SMP"; + } else { + return "Unknown"; + } + + return 0; +} +*/