]> arthur.barton.de Git - netatalk.git/blob - include/atalk/server_child.h
Merge from branch 2-1
[netatalk.git] / include / atalk / server_child.h
1 /*
2  * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
3  * All rights reserved.
4  */
5
6 #ifndef _ATALK_SERVER_CHILD_H
7 #define _ATALK_SERVER_CHILD_H 1
8
9 #include <sys/cdefs.h>
10 #include <sys/types.h>
11 #include <netatalk/endian.h>
12
13 /* useful stuff for child processes. most of this is hidden in 
14  * server_child.c to ease changes in implementation */
15
16 #define CHILD_NFORKS   2
17 #define CHILD_ASPFORK  0
18 #define CHILD_PAPFORK  0
19 #define CHILD_DSIFORK  1
20
21 typedef struct server_child {
22   void *fork;
23   int count, nsessions, nforks;
24 } server_child;
25
26 typedef struct server_child_data {
27   pid_t     pid;                /* afpd worker process pid (from the worker afpd process )*/
28   uid_t     uid;                /* user id of connected client (from the worker afpd process) */
29   int       valid;              /* 1 if we have a clientid */
30   uint32_t  time;               /* client boot time (from the mac client) */
31   int       killed;             /* 1 if we already tried to kill the client */
32   uint32_t  idlen;              /* clientid len (from the Mac client) */
33   char      *clientid;  /* clientid (from the Mac client) */
34   int       ipc_fds[2]; /* socketpair for IPC bw */
35   struct server_child_data **prevp, *next;
36 } afp_child_t;
37
38 extern int parent_or_child;
39
40 /* server_child.c */
41 extern server_child *server_child_alloc (const int, const int);
42 extern afp_child_t *server_child_add (server_child *, int, pid_t, uint ipc_fds[2]);
43 extern int  server_child_remove (server_child *, const int, const pid_t);
44 extern void server_child_free (server_child *);
45
46 extern void server_child_kill (server_child *, const int, const int);
47 extern void server_child_kill_one_by_id (server_child *children, const int forkid, const pid_t pid, const uid_t,
48                                                const u_int32_t len, char *id, u_int32_t boottime);
49 extern int  server_child_transfer_session(server_child *children, int forkid, pid_t, uid_t, int, uint16_t);
50 extern void server_child_setup (server_child *, const int, void (*)(const pid_t));
51 extern void server_child_handler (server_child *);
52 extern void server_reset_signal (void);
53
54 #endif