]> git.saurik.com Git - apple/syslog.git/blame - aslcommon/asl_memory.h
syslog-385.tar.gz
[apple/syslog.git] / aslcommon / asl_memory.h
CommitLineData
57b0aad2
A
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>
5222c21d 28#include <dispatch/dispatch.h>
57b0aad2
A
29
30typedef struct
31{
32 uint32_t hash;
33 uint32_t refcount;
5222c21d 34 char *str;
57b0aad2
A
35} mem_string_t;
36
37typedef struct
38{
39 uint64_t mid;
40 uint64_t time;
f3df4c03 41 uint64_t os_activity_id;
57b0aad2
A
42 mem_string_t *host;
43 mem_string_t *sender;
81582353 44 mem_string_t *sender_mach_uuid;
57b0aad2
A
45 mem_string_t *facility;
46 mem_string_t *message;
47 mem_string_t *refproc;
48 mem_string_t *session;
49 mem_string_t **kvlist;
5222c21d
A
50 uint32_t nano;
51 uint32_t pid;
52 uint32_t uid;
53 uint32_t gid;
54 uint32_t ruid;
55 uint32_t rgid;
56 uint32_t refpid;
57 uint32_t kvcount;
58 uint16_t flags;
59 uint8_t level;
60 uint8_t unused_0;
57b0aad2
A
61} mem_record_t;
62
63typedef struct
64{
5222c21d
A
65 mem_string_t **string_cache;
66 mem_record_t **record;
67 mem_record_t *buffer_record;
57b0aad2 68 uint32_t string_count;
57b0aad2
A
69 uint32_t record_count;
70 uint32_t record_first;
5222c21d
A
71 size_t max_string_mem;
72 size_t curr_string_mem;
73 dispatch_queue_t queue;
57b0aad2
A
74} asl_memory_t;
75
f3df4c03 76uint32_t asl_memory_open(uint32_t max_records, size_t max_str_mem, asl_memory_t **s);
57b0aad2 77uint32_t asl_memory_close(asl_memory_t *s);
f3df4c03 78uint32_t asl_memory_statistics(asl_memory_t *s, asl_msg_t **msg);
57b0aad2 79
f3df4c03
A
80uint32_t asl_memory_save(asl_memory_t *s, asl_msg_t *msg, uint64_t *mid);
81uint32_t asl_memory_fetch(asl_memory_t *s, uint64_t mid, asl_msg_t **msg, int32_t ruid, int32_t rgid);
57b0aad2 82
f3df4c03
A
83uint32_t asl_memory_match(asl_memory_t *s, asl_msg_list_t *query, asl_msg_list_t **res, uint64_t *last_id, uint64_t start_id, uint32_t count, int32_t direction, int32_t ruid, int32_t rgid);
84uint32_t asl_memory_match_restricted_uuid(asl_memory_t *s, asl_msg_list_t *query, asl_msg_list_t **res, uint64_t *last_id, uint64_t start_id, uint32_t count, uint32_t duration, int32_t direction, int32_t ruid, int32_t rgid, const char *uuid_str);
57b0aad2 85
db78b1bd 86#endif /* __ASL_MEMORY_H__ */