+#define DB_TYPE_FILE 0x00000001
+#define DB_TYPE_MEMORY 0x00000002
+#define DB_TYPE_MINI 0x00000004
+
+#define KERN_DISASTER_LEVEL 3
+
+#define SOURCE_UNKNOWN 0
+#define SOURCE_INTERNAL 1
+#define SOURCE_ASL_SOCKET 2
+#define SOURCE_BSD_SOCKET 3
+#define SOURCE_UDP_SOCKET 4
+#define SOURCE_KERN 5
+#define SOURCE_ASL_MESSAGE 6
+#define SOURCE_LAUNCHD 7
+
+#define SOURCE_SESSION 100 /* does not generate messages */
+
+#define STORE_FLAGS_FILE_CACHE_SWEEP_REQUESTED 0x00000001
+
+#define RESET_NONE 0
+#define RESET_CONFIG 1
+#define RESET_NETWORK 2
+
+struct global_s
+{
+ OSSpinLock lock;
+ int client_count;
+ int disaster_occurred;
+ mach_port_t listen_set;
+ mach_port_t server_port;
+ mach_port_t self_port;
+ mach_port_t dead_session_port;
+ launch_data_t launch_dict;
+ uint32_t store_flags;
+ time_t start_time;
+ int lockdown_session_fd;
+ int watchers_active;
+ int kfd;
+ int reset;
+ uint64_t bsd_flush_time;
+ pthread_mutex_t *db_lock;
+ pthread_mutex_t *work_queue_lock;
+ pthread_cond_t work_queue_cond;
+ asl_search_result_t *work_queue;
+ asl_store_t *file_db;
+ asl_memory_t *memory_db;
+ asl_mini_memory_t *mini_db;
+ asl_mini_memory_t *disaster_db;
+
+ /* parameters below are configurable as command-line args or in /etc/asl.conf */
+ int asl_log_filter;
+ int debug;
+ char *debug_file;
+ int dbtype;
+ uint32_t db_file_max;
+ uint32_t db_memory_max;
+ uint32_t db_mini_max;
+ uint32_t mps_limit;
+ uint64_t bsd_max_dup_time;
+ uint64_t asl_store_ping_time;
+ uint64_t mark_time;
+ time_t utmp_ttl;
+ time_t fs_ttl;
+};
+
+extern struct global_s global;
+
+typedef aslmsg (*aslreadfn)(int);
+typedef char *(*aslwritefn)(const char *, int);
+typedef char *(*aslexceptfn)(int);
+typedef int (*aslsendmsgfn)(aslmsg msg, const char *outid);
+
+struct aslevent
+{
+ int source;
+ int fd;
+ unsigned char read:1;
+ unsigned char write:1;
+ unsigned char except:1;
+ aslreadfn readfn;
+ aslwritefn writefn;
+ aslexceptfn exceptfn;
+ char *sender;
+ uid_t uid;
+ gid_t gid;
+ TAILQ_ENTRY(aslevent) entries;
+};
+