aboutsummaryrefslogtreecommitdiffstats
path: root/sdk/net/stream.h
blob: 268d881aba623e278fae192058eb714737a36f55 (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
/*
 * Stream oriented TCP session routines.
 * $Id$
 * Copyright (c) 1997 by Tycho Softworks.
 * For conditions of distribution and reuse see product license.
 */

#ifndef	__NET_STREAM_H__
#define	__NET_STREAM_H__

#ifndef	__NET_SOCKET_H__
#include <net/socket.h>
#endif

#define	tcppeer(fp)	peername(fileno(fp))
#define	tcphome(fp)	homename(fileno(fp))

typedef	FILE	*STREAM;

#ifdef	__cplusplus
extern "C" {
#endif

#ifdef	__NAMESPACE
#define	opentcp		__NAMESPACE(opentcp)
#define	accepttcp	__NAMESPACE(accepttcp)
#define	gettcp		__NAMESPACE(gettcp)
#define	puttcp		__NAMESPACE(puttcp)
#define	closetcp	__NAMESPACE(closetcp)
#define	buftcp		__NAMESPACE(buftcp)
#endif

STREAM	opentcp(const char *hostname, int port);
STREAM	accepttcp(SOCKET so); 
char	*gettcp(char *buf, size_t count, STREAM fp);
int	puttcp(char *str, STREAM fp);
void	closetcp(STREAM fp);
int	buftcp(STREAM fp, int size);

#ifdef	__cplusplus
}
#endif

#endif