]> git.saurik.com Git - apple/syslog.git/blob - aslcommon/asl_memory.h
syslog-217.1.4.tar.gz
[apple/syslog.git] / aslcommon / asl_memory.h
1 /*
2 * Copyright (c) 2007-2008 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 #ifndef __ASL_MEMORY_H__
25 #define __ASL_MEMORY_H__
26 #include <stdint.h>
27 #include <asl.h>
28
29 typedef struct
30 {
31 uint32_t hash;
32 uint32_t refcount;
33 char str[];
34 } mem_string_t;
35
36 typedef struct
37 {
38 uint64_t mid;
39 uint64_t time;
40 uint32_t nano;
41 uint8_t unused_0;
42 uint8_t level;
43 uint16_t flags;
44 uint32_t pid;
45 uint32_t uid;
46 uint32_t gid;
47 uint32_t ruid;
48 uint32_t rgid;
49 uint32_t refpid;
50 uint32_t kvcount;
51 mem_string_t *host;
52 mem_string_t *sender;
53 mem_string_t *sender_mach_uuid;
54 mem_string_t *facility;
55 mem_string_t *message;
56 mem_string_t *refproc;
57 mem_string_t *session;
58 mem_string_t **kvlist;
59 } mem_record_t;
60
61 typedef struct
62 {
63 uint32_t string_count;
64 void **string_cache;
65 uint32_t record_count;
66 uint32_t record_first;
67 mem_record_t **record;
68 mem_record_t *buffer_record;
69 } asl_memory_t;
70
71 uint32_t asl_memory_open(uint32_t max_records, asl_memory_t **s);
72 uint32_t asl_memory_close(asl_memory_t *s);
73 uint32_t asl_memory_statistics(asl_memory_t *s, aslmsg *msg);
74
75 uint32_t asl_memory_save(asl_memory_t *s, aslmsg msg, uint64_t *mid);
76 uint32_t asl_memory_fetch(asl_memory_t *s, uint64_t mid, aslmsg *msg, int32_t ruid, int32_t rgid);
77
78 uint32_t asl_memory_match(asl_memory_t *s, aslresponse query, aslresponse *res, uint64_t *last_id, uint64_t start_id, uint32_t count, int32_t direction, int32_t ruid, int32_t rgid);
79 uint32_t asl_memory_match_restricted_uuid(asl_memory_t *s, aslresponse query, aslresponse *res, uint64_t *last_id, uint64_t start_id, uint32_t count, int32_t direction, int32_t ruid, int32_t rgid, const char *uuid_str);
80
81 #endif /* __ASL_MEMORY_H__ */