summaryrefslogtreecommitdiff
path: root/comm/OLD/PortServer.h
blob: 1cd8ff5f14dbd489173ebb381e1fb8d6a6b0c27d (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
/*
 *	The Unix Channel
 *
 *	by Michel Beaudouin-Lafon
 *
 *	Copyright 1990-1993
 *	Laboratoire de Recherche en Informatique (LRI)
 *
 *	Port server : client side
 *
 *	$Id$
 *	$CurLog$
 */

#ifndef PortServer_H_
#define PortServer_H_

#include "Socket.h"
#include "ccu/String.h"
class UchDatagram;

typedef int (* PortServMatchFun) (const char*, lword, sword, const char*);

class  UchPortServer {
protected:
	UchDatagram*	Serv;
	CcuString	Name;

public:
	UchPortServer (const char*, const char* = 0);
	~UchPortServer ();
	
	void		Register (const char*, UchInetAddress&, int = 0);
	void		Remove (const char*, UchInetAddress&, int = 0);
	UchInetAddress*	Inquire (const char*, int = 10);
	int		Match (const char*, PortServMatchFun, int = 10);
	void		Dump ();
	void		Quit ();
	char*		MakeKey (const char*);
};

extern	void		PortServerRegister (const char*, const char*, UchInetAddress&);
extern	void		PortServerRemove (const char*, const char*, UchInetAddress&);
inline	void		PortServerRegister (const char* s, const char* h, UchAddress* a)		{ PortServerRegister (s, h, * ((UchInetAddress*) a)); }
inline	void		PortServerRemove (const char* s, const char* h, UchAddress* a)		{ PortServerRemove (s, h, * ((UchInetAddress*) a)); }
extern	UchInetAddress*	PortServerInquire (const char*, const char*, const char* = 0);

#endif /* PortServer_H_ */