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