]> git.saurik.com Git - apple/libc.git/blob - gen/asl_legacy1.h
Libc-763.12.tar.gz
[apple/libc.git] / gen / asl_legacy1.h
1 #ifndef __ASL_LEGACY1_H__
2 #define __ASL_LEGACY1_H__
3
4 /*
5 * Copyright (c) 2007 Apple Inc. All rights reserved.
6 *
7 * @APPLE_LICENSE_HEADER_START@
8 *
9 * "Portions Copyright (c) 2007 Apple Inc. All Rights
10 * Reserved. This file contains Original Code and/or Modifications of
11 * Original Code as defined in and that are subject to the Apple Public
12 * Source License Version 1.0 (the 'License'). You may not use this file
13 * except in compliance with the License. Please obtain a copy of the
14 * License at http://www.apple.com/publicsource and read it before using
15 * this file.
16 *
17 * The Original Code and all software distributed under the License are
18 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
19 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
20 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
22 * License for the specific language governing rights and limitations
23 * under the License."
24 *
25 * @APPLE_LICENSE_HEADER_END@
26 */
27
28 /*
29 * ASL Database VERSION 1 (LEGACY)
30 *
31 * Log messages are stored in 80 byte records of the form:
32 *
33 * | 1 | 4 | 8 | 4 | 4 | 8 | 8 | 8 | 8 | 4 | 4 | 4 | 4 | 8 | 2 | 1 | (80 bytes)
34 * | Type | Next | ID | RUID | RGID | Time | Host | Sender | Facility | LEVEL | PID | UID | GID | Message | Flags | Zero |
35 *
36 * If there are no additional key/value pairs in the message, Next will be zero. If there are additional
37 * key/value pairs in the database, Next is a record number for a record with the format:
38 *
39 * | 1 | 4 | 4 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 7 | (80 bytes)
40 * | Type | Next | Count | Key1 | Val1 | Key2 | Val2 | Key3 | Val3 | Key4 | Val4 | Zero |
41 *
42 * Additional records will be chained using the Next field, with the count field left zero.
43 *
44 * Strings stored in records of the form:
45 *
46 * | 1 | 4 | 8 | 4 | 4 | 4 | 55 | (80 bytes)
47 * | Type | Next | ID | Refcount | Hash | Length | String |
48 *
49 * If the string is longer than 55 bytes, Next is a record number for a record with the format:
50 *
51 * | 1 | 4 | 75 | (80 bytes)
52 * | Type | Next | String |
53 *
54 * The first record (header) in the database has the format:
55 *
56 * | 12 | 4 | 8 | 56 | (80 bytes)
57 * | Cookie | Vers | Max ID | Zero |
58 *
59 */
60
61 #include <stdio.h>
62 #include <stdint.h>
63 #include <unistd.h>
64 #include <asl.h>
65 #include <Availability.h>
66
67 typedef struct
68 {
69 uint8_t type;
70 uint32_t slot;
71 uint64_t xid;
72 uint32_t hash;
73 } asl_legacy1_slot_info_t;
74
75 typedef struct
76 {
77 asl_legacy1_slot_info_t *slotlist;
78 uint32_t slotlist_count;
79 FILE *db;
80 } asl_legacy1_t;
81
82 uint32_t asl_legacy1_open(const char *path, asl_legacy1_t **s) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
83 uint32_t asl_legacy1_close(asl_legacy1_t *s) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
84 uint32_t asl_legacy1_fetch(asl_legacy1_t *s, uint64_t msgid, aslmsg *msg) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
85 uint32_t asl_legacy1_match(asl_legacy1_t *s, aslresponse query, aslresponse *res, uint64_t *last_id, uint64_t start_id, uint32_t count, int32_t direction) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
86
87 #endif /*__ASL_LEGACY1_H__*/