00001 /* 00002 ** gates.h for gate-srv in /home/pwipwi/lse/lseos/lseos-srv/basic/gate 00003 ** 00004 ** Made by (Christophe Eymard) 00005 ** Login <eymard_c@epita.fr> 00006 ** 00007 ** Started on Thu Mar 17 15:22:37 2005 Christophe Eymard 00008 ** Last update Sun Mar 20 15:39:35 2005 Christophe Eymard 00009 */ 00010 00011 #ifndef GATES_H_ 00012 # define GATES_H_ 00013 00014 # include <libc.h> 00015 # include "libgate.h" 00016 00017 # define GATE_BUF_SZ 32 00018 # define PROC_BUF_SZ 32 00019 00020 typedef struct 00021 { 00022 pid_t process; 00023 unsigned int occur; 00024 } t_gate_process; 00025 00026 typedef struct 00027 { 00028 pid_t pid; 00029 t_gate_process *processes; 00030 unsigned int nb_processes; 00031 t_gate_infos gate_infos; 00032 } t_gate; 00033 00034 typedef struct 00035 { 00036 int class; 00037 t_gate **gates; 00038 int nb_gates; 00039 } t_class; 00040 00041 t_class *class_new(int class); 00042 void class_free(t_class *class); 00043 t_gate *gate_new(pid_t pid, t_gate_infos *gate_infos); 00044 void gate_free(t_gate *gate); 00045 00046 int add_gate_to_class(t_class *cl, t_gate *gate); 00047 00048 int del_gate_from_class(t_class *cl, int gate); 00049 00050 int get_gate_from_class(t_class *cl, t_gate_infos *gate, int nb); 00051 00052 int add_process_to_gate_in_class(t_class *cl, 00053 int gate, 00054 pid_t pid); 00055 00056 int del_process_from_gate_in_class(t_class *cl, 00057 int gate, 00058 pid_t pid); 00059 00060 #endif /* !GATES_H_ */