summaryrefslogtreecommitdiff
path: root/comm/IrdaAddress.cc
blob: 4beceb2c522241b2d76b3863574a732728ebf870 (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
60
61
62
63
64
65
66
67
68
69
/*
 *	The Unix Channel
 *
 *	by Michel Beaudouin-Lafon
 *
 *	Copyright 1990-2000
 *	Laboratoire de Recherche en Informatique (LRI)
 *
 *	IRDA Addresses,
 *	by Stephane Chatty
 *
 *	$Id$
 *	$CurLog$
 */

#include "cplus_bugs.h"
#include "IrdaAddress.h"
#include <stdio.h>
#include <memory.h>

#ifndef AF_IRDA
#define AF_IRDA 23
#endif /* AF_IRDA */

IvlIrdaAddress :: IvlIrdaAddress (const char* service)
: IvlAddress (),
  Service (service ? service : "OBEX")
{
	Addr.sir_family = AF_IRDA;
	strncpy (Addr.sir_name, Service, 25);
	Addr.sir_lsap_sel = LSAP_ANY;
	Valid = true;
}

/*?nodoc?*/
IvlIrdaAddress :: ~IvlIrdaAddress ()
{
}


int
IvlIrdaAddress :: Family ()
{
	return AF_IRDA;
}


int
IvlIrdaAddress :: Length ()
{
	return sizeof (Addr);
}


SockAddr*
IvlIrdaAddress :: GetSockAddr ()
{
	return (SockAddr*) &Addr;
}


char*
IvlIrdaAddress :: StrRepr (char* buf)
{
	if (! buf)
		buf = new char [ strlen (Service) + 1 + 5];
	sprintf (buf, "IRDA:%s", (const char*) Service);
	return buf;
}