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_host_8cpp_source.html | 220 ++++++++++++++++++++++++++++ 1 file changed, 220 insertions(+) create mode 100644 Doc/doxygen/html/_net_host_8cpp_source.html (limited to 'Doc/doxygen/html/_net_host_8cpp_source.html') diff --git a/Doc/doxygen/html/_net_host_8cpp_source.html b/Doc/doxygen/html/_net_host_8cpp_source.html new file mode 100644 index 0000000..9b11ced --- /dev/null +++ b/Doc/doxygen/html/_net_host_8cpp_source.html @@ -0,0 +1,220 @@ + + + + + +Starshatter_Open: D:/SRC/StarshatterSVN/NetEx/NetHost.cpp Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Starshatter_Open +
+
Open source Starshatter engine
+
+
+ + + + + +
+
+ +
+
+
+ +
+ + + + +
+ +
+ +
+
+
NetHost.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: NetHost.cpp
+
7  AUTHOR: John DiCamillo
+
8 
+
9 
+
10  OVERVIEW
+
11  ========
+
12  Network Host
+
13 */
+
14 
+
15 
+
16 #include "MemDebug.h"
+
17 #include "NetHost.h"
+
18 #include "NetLayer.h"
+
19 #include <ctype.h>
+
20 
+ +
22 {
+
23  char host_name[256];
+
24  gethostname(host_name, sizeof(host_name));
+
25 
+
26  Init(host_name);
+
27 }
+
28 
+
29 NetHost::NetHost(const char* host_name)
+
30 {
+
31  Init(host_name);
+
32 }
+
33 
+
34 void NetHost::Init(const char* host_name)
+
35 {
+
36  if (host_name && *host_name) {
+
37  HOSTENT* h = 0;
+
38 
+
39  if (isdigit(*host_name)) {
+
40  DWORD addr = inet_addr(host_name);
+
41  h = gethostbyaddr((const char*) &addr, 4, AF_INET);
+
42  }
+
43  else {
+
44  h = gethostbyname(host_name);
+
45  }
+
46 
+
47  if (h) {
+
48  name = h->h_name;
+
49 
+
50  char** alias = h->h_aliases;
+
51  while (*alias) {
+
52  aliases.append(new Text(*alias));
+
53  alias++;
+
54  }
+
55 
+
56  char** addr = h->h_addr_list;
+
57  while (*addr) {
+
58  NetAddr* pna = new(__FILE__,__LINE__) NetAddr(**(DWORD**) addr);
+
59  if (pna)
+
60  addresses.append(pna);
+
61  addr++;
+
62  }
+
63  }
+
64  }
+
65 }
+
66 
+ +
68 {
+
69  if (&n != this) {
+
70  NetHost& nh = (NetHost&) n;
+
71 
+
72  name = nh.name;
+
73 
+
74  ListIter<Text> alias = nh.aliases;
+
75  while (++alias)
+
76  aliases.append(new Text(*alias.value()));
+
77 
+
78  ListIter<NetAddr> addr = nh.addresses;
+
79  while (++addr)
+
80  addresses.append(new NetAddr(*addr.value()));
+
81  }
+
82 }
+
83 
+ +
85 {
+
86  aliases.destroy();
+
87  addresses.destroy();
+
88 }
+
89 
+
90 const char*
+ +
92 {
+
93  return name;
+
94 }
+
95 
+
96 NetAddr
+ +
98 {
+
99  if (addresses.size())
+
100  return *(addresses[0]);
+
101 
+
102  return NetAddr((DWORD) 0);
+
103 }
+
+
+ + + + -- cgit v1.1