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 21typedef struct server_child { 22 void *fork; 23 int count, nsessions, nforks; 24} server_child; 25 26typedef 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 int killed; /* 1 if we already tried to kill the client */ 31 int disasociated; /* 1 if this is not a child, but a child from a previous afpd master */ 32 uint32_t time; /* client boot time (from the mac client) */ 33 uint32_t idlen; /* clientid len (from the Mac client) */ 34 char *clientid; /* clientid (from the Mac client) */ 35 int ipc_fds[2]; /* socketpair for IPC bw */ 36 struct server_child_data **prevp, *next; 37} afp_child_t; 38 39extern int parent_or_child; 40 41/* server_child.c */ 42extern server_child *server_child_alloc (const int, const int); 43extern afp_child_t *server_child_add (server_child *, int, pid_t, uint ipc_fds[2]); 44extern int server_child_remove (server_child *, const int, const pid_t); 45extern void server_child_free (server_child *); 46 47extern void server_child_kill (server_child *, const int, const int); 48extern void server_child_kill_one_by_id (server_child *children, const int forkid, const pid_t pid, const uid_t, 49 const u_int32_t len, char *id, u_int32_t boottime); 50extern int server_child_transfer_session(server_child *children, int forkid, pid_t, uid_t, int, uint16_t); 51extern void server_child_setup (server_child *, const int, void (*)(const pid_t)); 52extern void server_child_handler (server_child *); 53extern void server_reset_signal (void); 54 55#endif 56