From 8898ad9b25fca6afe2374d293a981db02a83d7e9 Mon Sep 17 00:00:00 2001 From: "FWoltermann@gmail.com" Date: Thu, 31 May 2012 14:46:27 +0000 Subject: Committing the documentation to svn to have it accessible online --- Doc/doxygen/html/_net_addr_8cpp_source.html | 224 ++++++++++++++++++++++++++++ 1 file changed, 224 insertions(+) create mode 100644 Doc/doxygen/html/_net_addr_8cpp_source.html (limited to 'Doc/doxygen/html/_net_addr_8cpp_source.html') diff --git a/Doc/doxygen/html/_net_addr_8cpp_source.html b/Doc/doxygen/html/_net_addr_8cpp_source.html new file mode 100644 index 0000000..76c94b9 --- /dev/null +++ b/Doc/doxygen/html/_net_addr_8cpp_source.html @@ -0,0 +1,224 @@ + + + + + +Starshatter_Open: D:/SRC/StarshatterSVN/NetEx/NetAddr.cpp Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Starshatter_Open +
+
Open source Starshatter engine
+
+
+ + + + + +
+
+ +
+
+
+ +
+ + + + +
+ +
+ +
+
+
NetAddr.cpp
+
+
+Go to the documentation of this file.
1 /* Project nGenEx
+
2  Destroyer Studios LLC
+
3  Copyright © 1997-2004. All Rights Reserved.
+
4 
+
5  SUBSYSTEM: NetEx.lib
+
6  FILE: NetAddr.cpp
+
7  AUTHOR: John DiCamillo
+
8 
+
9 
+
10  OVERVIEW
+
11  ========
+
12  Network Address
+
13 */
+
14 
+
15 
+
16 #include "MemDebug.h"
+
17 #include "NetAddr.h"
+
18 #include "NetHost.h"
+
19 #include "NetLayer.h"
+
20 #include <ctype.h>
+
21 
+
22 NetAddr::NetAddr(const char* host_name, WORD p)
+
23  : addr(0), port(p)
+
24 {
+
25  if (host_name && *host_name) {
+
26  HOSTENT* h = 0;
+
27 
+
28  if (isdigit(*host_name)) {
+
29  DWORD a = inet_addr(host_name);
+
30  h = gethostbyaddr((const char*) &a, 4, AF_INET);
+
31  }
+
32  else {
+
33  h = gethostbyname(host_name);
+
34  }
+
35 
+
36  if (h) {
+
37  if (h->h_addr_list) {
+
38  addr = **(DWORD**) (h->h_addr_list);
+
39  }
+
40  }
+
41  }
+
42 
+
43  Init();
+
44 }
+
45 
+
46 NetAddr::NetAddr(DWORD a, WORD p)
+
47  : addr(a), port(p)
+
48 {
+
49  Init();
+
50 }
+
51 
+ +
53  : addr(n.addr), port(n.port)
+
54 {
+
55  Init();
+
56 }
+
57 
+
58 // +--------------------------------------------------------------------+
+
59 
+
60 void
+
61 NetAddr::Init()
+
62 {
+
63  ZeroMemory(&sadr, sizeof(sadr));
+
64 
+
65  sadr.sin_family = AF_INET;
+
66  sadr.sin_port = ::htons(port);
+
67  sadr.sin_addr.s_addr = addr;
+
68 }
+
69 
+
70 void
+ +
72 {
+
73  addr = sadr.sin_addr.s_addr;
+
74  port = ::ntohs(sadr.sin_port);
+
75 }
+
76 
+
77 // +--------------------------------------------------------------------+
+
78 
+
79 sockaddr*
+ +
81 {
+
82  return (sockaddr*) &sadr;
+
83 }
+
84 
+
85 size_t
+ +
87 {
+
88  return sizeof(sadr);
+
89 }
+
90 
+
91 // +--------------------------------------------------------------------+
+
92 
+
93 void
+
94 NetAddr::SetSockAddr(sockaddr* s, int size)
+
95 {
+
96  if (s) {
+
97  ZeroMemory(&sadr, sizeof(sadr));
+
98 
+
99  if (size > sizeof(sadr))
+
100  CopyMemory(&sadr, s, sizeof(sadr));
+
101  else
+
102  CopyMemory(&sadr, s, size);
+
103 
+ +
105  }
+
106 }
+
107 
+
+
+ + + + -- cgit v1.1