summaryrefslogtreecommitdiff
path: root/comm/InetAddress.h
blob: a7b1adc4c2bb2da0b3df799498d6faa93647535e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
 *	Ivy League
 *
 *	INET Addresses
 *
 *	Copyright 1990-2000
 *	Laboratoire de Recherche en Informatique (LRI)
 *	Centre d'Etudes de la Navigation Aerienne (CENA)
 *
 *	original code by Michel Beaudouin-Lafon,
 *	modified by Stephane Chatty
 *
 *	$Id$
 *
 */

#ifndef InetAddress_H_
#define InetAddress_H_

#include "cplus_bugs.h"
#include "error.h"
#include "Address.h"

class IvlInetAddress : public IvlAddress {
protected:
	IvlString		HostName;
	bool		HasHostName;
	struct sockaddr_in	Addr;

	const char*     GetNoHostName ();

public:
		IvlInetAddress ();
		IvlInetAddress (lword, sword);		// hostid, port#
		IvlInetAddress (const char*, sword = 0);	// hostname, port#
		~IvlInetAddress ();
	
	int		Family ();
	int		Length ();
	SockAddr*	GetSockAddr ();
	sword		Port ();
	lword		Host ();
	char*		StrRepr (char* buf = 0);
	const char*	GetHostName ();
	
static	lword		LoopBack ();
};

#ifndef INADDR_LOOPBACK
#define INADDR_LOOPBACK	(INET_ADDR::LoopBack ())
#endif

#define ANYADDR	((lword) INADDR_ANY)
#define LOOPBACK	((lword) INADDR_LOOPBACK)
#define BROADCAST	((lword) INADDR_BROADCAST)



#endif	/* InetAddress_H_ */