1 /*	$NetBSD: master_proto.h,v 1.2 2020/03/18 19:05:16 christos Exp $	*/
2 
3 /*++
4 /* NAME
5 /*	master_proto 3h
6 /* SUMMARY
7 /*	master process protocol
8 /* SYNOPSIS
9 /*	#include <master_proto.h>
10 /* DESCRIPTION
11 /* .nf
12 
13  /*
14   * Transport names. The master passes the transport name on the command
15   * line, and thus the name is part of the master to child protocol.
16   */
17 #define MASTER_XPORT_NAME_UNIX	"unix"	/* local IPC */
18 #define MASTER_XPORT_NAME_FIFO	"fifo"	/* local IPC */
19 #define MASTER_XPORT_NAME_INET	"inet"	/* non-local IPC */
20 #define MASTER_XPORT_NAME_PASS	"pass"	/* local IPC */
21 #define MASTER_XPORT_NAME_UXDG	"unix-dgram"	/* local IPC */
22 
23  /*
24   * Format of a status message sent by a child process to the process
25   * manager. Since this is between processes on the same machine we need not
26   * worry about byte order and word length.
27   */
28 typedef struct MASTER_STATUS {
29     int     pid;			/* process ID */
30     unsigned gen;			/* child generation number */
31     int     avail;			/* availability */
32 } MASTER_STATUS;
33 
34 #define MASTER_GEN_NAME	"GENERATION"	/* passed via environment */
35 
36 #define MASTER_STAT_TAKEN	0	/* this one is occupied */
37 #define MASTER_STAT_AVAIL	1	/* this process is idle */
38 
39 extern int master_notify(int, unsigned, int);	/* encapsulate status msg */
40 
41  /*
42   * File descriptors inherited from the master process. The flow control pipe
43   * is read by receive processes and is written to by send processes. If
44   * receive processes get too far ahead they will pause for a brief moment.
45   */
46 #define MASTER_FLOW_READ	3
47 #define MASTER_FLOW_WRITE	4
48 
49  /*
50   * File descriptors inherited from the master process. All processes that
51   * provide a given service share the same status file descriptor, and listen
52   * on the same service socket(s). The kernel decides what process gets the
53   * next connection. Usually the number of listening processes is small, so
54   * one connection will not cause a "thundering herd" effect. When no process
55   * listens on a given socket, the master process will. MASTER_LISTEN_FD is
56   * actually the lowest-numbered descriptor of a sequence of descriptors to
57   * listen on.
58   */
59 #define MASTER_STATUS_FD	5	/* shared channel to parent */
60 #define MASTER_LISTEN_FD	6	/* accept connections here */
61 
62 /* LICENSE
63 /* .ad
64 /* .fi
65 /*	The Secure Mailer license must be distributed with this software.
66 /* AUTHOR(S)
67 /*	Wietse Venema
68 /*	IBM T.J. Watson Research
69 /*	P.O. Box 704
70 /*	Yorktown Heights, NY 10598, USA
71 /*
72 /*	Wietse Venema
73 /*	Google, Inc.
74 /*	111 8th Avenue
75 /*	New York, NY 10011, USA
76 /*--*/
77 
78