File: common.h

package info (click to toggle)
netpipes 4.2-8
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, stretch, trixie
  • size: 804 kB
  • ctags: 587
  • sloc: ansic: 8,599; makefile: 353
file content (107 lines) | stat: -rw-r--r-- 2,845 bytes parent folder | download
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*

    $id$, part of
    faucet and hose: network pipe utilities
    Copyright (C) 1992-98 Robert Forsman

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

    */

#ifndef common_h_
#define common_h_

/* set from argv[0] by the main() routine */
extern char *programname;

/* list of file descriptors to dup from the socket */
extern int	*fds;
extern int	nfds;

/* the mode to use when shutting down the socket
	<0: don't do any shutdown
	0 : shut down recieves (write-only)
	>0: shut down sends (read-only)
  */

extern int	how_shutdown;

/* add a file descriptor to the list */
void add_fd(/* int fd */);

/* add a file descriptor to the list */
void reserve_fds(/* int placeholder */);

/* do the dup from the argument socket to the list of file descriptors,
   perform the requested shutdown... */
void dup_n(/*int socket */);

/**********************************************************************/

int get_port(/* struct sockaddr_storage * */);
void set_port(/* struct sockaddr_storage *, int */);

int name_to_inet_port(/* char* */);

/**********************************************************************/

struct sockaddr_storage ** /* addr_array */
convert_hostname(/* char *, int * */);

/**********************************************************************/

void
printhost(/* FILE, struct sockaddr * */);

/**********************************************************************/

int
bindlocal(/* int, char *, char*, int, int */);

/**********************************************************************/

void				/* this is in version.c */
emit_version(/* char*, int */);

				/* this is also in version.c */
extern char *progname;
void set_progname(/* char *argv0 */);

/* system dependencies */

#ifdef NO_STRERROR
/* XXX assumption here that no strerror() means */
/* no definition of sys_errlist in errno.h */
extern char *sys_errlist[];

char * strerror(/*int*/);
#endif

#ifdef POSIX_SIG
#define signal(a, b) { \
  struct sigaction sa; \
  sa.sa_handler = b; \
  sigemptyset(&sa.sa_mask); \
  sa.sa_flags = 0; \
  sigaction(a, &sa, NULL); \
}
#endif
#ifdef SYSV
#define signal(a, b) sigset(a, b)
#endif

int valid_descriptor(/*int fd */);

#endif /* common_h_ */