libassa
3.5.1
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
assa
INETAddress.h
Go to the documentation of this file.
1
// -*- c++ -*-
2
//------------------------------------------------------------------------------
3
// INETAddress.h
4
//------------------------------------------------------------------------------
5
// Copyright (c) 1999 by Vladislav Grinchenko
6
//
7
// This library is free software; you can redistribute it and/or
8
// modify it under the terms of the GNU Library General Public
9
// License as published by the Free Software Foundation; either
10
// version 2 of the License, or (at your option) any later version.
11
//------------------------------------------------------------------------------
12
#ifndef INET_ADDRESS_H
13
#define INET_ADDRESS_H
14
15
#include <vector>
16
using
std::vector;
17
18
#include "
assa/Address.h
"
19
20
namespace
ASSA {
21
27
class
INETAddress
:
public
Address
{
28
public
:
30
enum
Protocol
{
31
TCP
,
32
UDP
33
};
34
35
public
:
37
INETAddress
();
38
45
INETAddress
(
struct
in_addr * haddr_,
int
port_);
46
53
INETAddress
(
const
char
* host_,
int
port_);
54
63
INETAddress
(
const
char
* host_,
const
char
* service_,
64
Protocol
protocol_ =
TCP
);
65
71
INETAddress
(
int
port_);
72
93
INETAddress
(
const
char
* address_,
Protocol
protocol_ =
TCP
);
94
96
INETAddress
(
SA_IN
* address_);
97
99
INETAddress
(
SA
* address_);
100
102
~INETAddress
() {
103
// trace_with_mask("INETAddress::~INETAddress",SOCKTRACE);
104
}
105
107
const
int
getLength
()
const
{
return
sizeof
(
m_address
); }
108
110
SA
*
getAddress
()
const
{
return
(
SA
*) &
m_address
; }
111
113
string
getHostName
();
114
116
int
getPort
()
const
{
return
ntohs (
m_address
.sin_port); }
117
119
void
dump
();
120
128
static
string
129
get_fully_qualified_domain_name
(vector<string>& aliases_);
130
131
private
:
148
void
createHostPort
(
const
char
* host_,
int
port_);
149
160
int
getServiceByName
(
string
serv_,
Protocol
prot_ =
TCP
);
161
164
void
init
();
165
166
private
:
168
static
string
m_fqdn_cache
;
169
170
private
:
172
SA_IN
m_address
;
173
};
174
175
176
}
// end namespace ASSA
177
178
#endif
/* INET_ADDRESS_H */
Generated on Wed Jun 13 2012 09:34:05 for libassa by
1.8.1