2 * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
6 #ifndef _ATALK_SERVER_CHILD_H
7 #define _ATALK_SERVER_CHILD_H 1
10 #include <arpa/inet.h>
13 /* useful stuff for child processes. most of this is hidden in
14 * server_child.c to ease changes in implementation */
16 #define CHILD_HASHSIZE 32
18 /* One AFP session child process */
19 typedef struct afp_child {
20 pid_t afpch_pid; /* afpd worker process pid (from the worker afpd process )*/
21 uid_t afpch_uid; /* user id of connected client (from the worker afpd process) */
22 int afpch_valid; /* 1 if we have a clientid */
23 int afpch_killed; /* 1 if we already tried to kill the client */
24 uint32_t afpch_boottime; /* client boot time (from the mac client) */
25 time_t afpch_logintime; /* time the child was added */
26 uint32_t afpch_idlen; /* clientid len (from the Mac client) */
27 char *afpch_clientid; /* clientid (from the Mac client) */
28 int afpch_ipc_fd; /* socket for IPC bw afpd parent and childs */
29 int16_t afpch_state; /* state of AFP session (eg active, sleeping, disconnected) */
30 char *afpch_volumes; /* mounted volumes */
31 struct afp_child **afpch_prevp;
32 struct afp_child *afpch_next;
35 /* Info and table with all AFP session child processes */
37 pthread_mutex_t servch_lock; /* Lock */
38 int servch_count; /* Current count of active AFP sessions */
39 int servch_nsessions; /* Number of allowed AFP sessions */
40 afp_child_t *servch_table[CHILD_HASHSIZE]; /* Hashtable with data of AFP sesssions */
44 extern server_child_t *server_child_alloc(int);
45 extern afp_child_t *server_child_add(server_child_t *, pid_t, int ipc_fd);
46 extern int server_child_remove(server_child_t *, pid_t);
47 extern void server_child_free(server_child_t *);
48 extern afp_child_t *server_child_resolve(server_child_t *childs, id_t pid);
50 extern void server_child_kill(server_child_t *, int);
51 extern void server_child_kill_one_by_id(server_child_t *children, pid_t pid, uid_t,
52 uint32_t len, char *id, uint32_t boottime);
53 extern int server_child_transfer_session(server_child_t *children, pid_t, uid_t, int, uint16_t);
54 extern void server_child_handler(server_child_t *);
55 extern void server_reset_signal(void);