]> arthur.barton.de Git - netatalk.git/blob - include/atalk/server_child.h
Writing metadata xattr on directories with sticky bit set, FR#94
[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/types.h>
10 #include <arpa/inet.h>
11 #include <pthread.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_HASHSIZE 32
17
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;
33 } afp_child_t;
34
35 /* Info and table with all AFP session child processes */
36 typedef struct {
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 */
41 } server_child_t;
42
43 /* server_child.c */
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);
49
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);
56
57 #endif