]>
git.saurik.com Git - apple/syslog.git/blob - libsystem_asl.tproj/include/asl_core.h
f9338721dafee3da80de7bd44c0a5f020fe13ffc
   5  * Copyright (c) 2007-2012 Apple Inc.  All rights reserved. 
   7  * @APPLE_LICENSE_HEADER_START@ 
   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 
  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. 
  24  * @APPLE_LICENSE_HEADER_END@ 
  30 #include <mach/mach.h> 
  31 #include <Availability.h> 
  32 #include <TargetConditionals.h> 
  34 #define streq(A, B) (strcmp(A, B) == 0) 
  35 #define strneq(A, B) (strcmp(A, B) != 0) 
  37 #define streq_len(A, B, C) (strncmp(A, B, C) == 0) 
  38 #define strneq_len(A, B, C) (strncmp(A, B, C) != 0) 
  40 #define strcaseeq(A, B) (strcasecmp(A, B) == 0) 
  41 #define strcaseneq(A, B) (strcasecmp(A, B) != 0) 
  43 #define strcaseeq_len(A, B, C) (strncasecmp(A, B, C) == 0) 
  44 #define strcaseneq_len(A, B, C) (strcasecmp(A, B, C) != 0) 
  46 typedef uint32_t ASL_STATUS
; 
  48 #define ASL_STATUS_OK               0 
  49 #define ASL_STATUS_INVALID_ARG      1 
  50 #define ASL_STATUS_INVALID_STORE    2 
  51 #define ASL_STATUS_INVALID_STRING   3 
  52 #define ASL_STATUS_INVALID_ID       4 
  53 #define ASL_STATUS_INVALID_MESSAGE  5 
  54 #define ASL_STATUS_NOT_FOUND        6 
  55 #define ASL_STATUS_READ_FAILED      7 
  56 #define ASL_STATUS_WRITE_FAILED     8 
  57 #define ASL_STATUS_NO_MEMORY        9 
  58 #define ASL_STATUS_ACCESS_DENIED   10 
  59 #define ASL_STATUS_READ_ONLY       11 
  60 #define ASL_STATUS_WRITE_ONLY      12 
  61 #define ASL_STATUS_MATCH_FAILED    13 
  62 #define ASL_STATUS_NO_RECORDS      14 
  63 #define ASL_STATUS_INVALID_TYPE    15 
  64 #define ASL_STATUS_FAILED        9999 
  66 #define ASL_REF_NULL 0xffffffffffffffffLL 
  68 #define ASL_MSG_FLAG_READ_UID_SET 0x0001 
  69 #define ASL_MSG_FLAG_READ_GID_SET 0x0002 
  70 #define ASL_MSG_FLAG_SEARCH_MATCH 0x8000 
  71 #define ASL_MSG_FLAG_SEARCH_CLEAR 0x7fff 
  73 #define ASL_QUERY_MATCH_SLOW     0x00000000 
  74 #define ASL_QUERY_MATCH_MSG_ID   0x00000001 
  75 #define ASL_QUERY_MATCH_TIME     0x00000002 
  76 #define ASL_QUERY_MATCH_NANO     0x00000004 
  77 #define ASL_QUERY_MATCH_LEVEL    0x00000008 
  78 #define ASL_QUERY_MATCH_PID      0x00000010 
  79 #define ASL_QUERY_MATCH_UID      0x00000020 
  80 #define ASL_QUERY_MATCH_GID      0x00000040 
  81 #define ASL_QUERY_MATCH_RUID     0x00000080 
  82 #define ASL_QUERY_MATCH_RGID     0x00000100 
  83 #define ASL_QUERY_MATCH_REF_PID  0x00000200 
  84 #define ASL_QUERY_MATCH_HOST     0x00000400 
  85 #define ASL_QUERY_MATCH_SENDER   0x00000800 
  86 #define ASL_QUERY_MATCH_SMUUID   0x00001000 
  87 #define ASL_QUERY_MATCH_FACILITY 0x00002000 
  88 #define ASL_QUERY_MATCH_MESSAGE  0x00004000 
  89 #define ASL_QUERY_MATCH_REF_PROC 0x00008000 
  90 #define ASL_QUERY_MATCH_SESSION  0x00010000 
  91 #define ASL_QUERY_MATCH_TRUE     0x80000000 
  92 #define ASL_QUERY_MATCH_FALSE    0x40000000 
  93 #define ASL_QUERY_MATCH_ERROR    0x20000000 
  95 #define ASL_SERVICE_NAME "com.apple.system.logger" 
  97 #define ASL_PLACE_DATABASE 0 
  98 #define ASL_PLACE_ARCHIVE 1 
 100 #if TARGET_OS_SIMULATOR 
 101 #define ASL_PLACE_DATABASE_DEFAULT asl_filesystem_path(ASL_PLACE_DATABASE) 
 102 #define ASL_PLACE_ARCHIVE_DEFAULT asl_filesystem_path(ASL_PLACE_ARCHIVE) 
 104 #define ASL_PLACE_DATABASE_DEFAULT "/var/log/asl" 
 105 #define ASL_PLACE_ARCHIVE_DEFAULT "/var/log/asl.archive" 
 108 mach_port_t 
asl_core_get_service_port(int reset
) __OSX_AVAILABLE_STARTING(__MAC_10_10
, __IPHONE_7_0
); 
 110 uint32_t asl_core_string_hash(const char *str
, uint32_t len
) __OSX_AVAILABLE_STARTING(__MAC_10_5
, __IPHONE_2_0
); 
 111 const char *asl_core_error(uint32_t code
) __OSX_AVAILABLE_STARTING(__MAC_10_5
, __IPHONE_2_0
); 
 112 const char *asl_core_level_to_string(uint32_t level
) __OSX_AVAILABLE_STARTING(__MAC_10_10
, __IPHONE_7_0
); 
 113 uint32_t asl_core_check_access(int32_t msgu
, int32_t msgg
, int32_t readu
, int32_t readg
, uint16_t flags
) __OSX_AVAILABLE_STARTING(__MAC_10_5
, __IPHONE_2_0
); 
 114 uint64_t asl_core_htonq(uint64_t n
) __OSX_AVAILABLE_STARTING(__MAC_10_5
, __IPHONE_2_0
); 
 115 uint64_t asl_core_ntohq(uint64_t n
)__OSX_AVAILABLE_STARTING(__MAC_10_5
, __IPHONE_2_0
); 
 116 uint64_t asl_core_new_msg_id(uint64_t start
) __OSX_AVAILABLE_STARTING(__MAC_10_5
, __IPHONE_2_0
); 
 117 char *asl_core_encode_buffer(const char *in
, uint32_t len
) __OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_5_0
); 
 118 int32_t asl_core_decode_buffer(const char *in
, char **buf
, uint32_t *len
) __OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_5_0
); 
 120 time_t asl_core_parse_time(const char *in
, uint32_t *tlen
) __OSX_AVAILABLE_STARTING(__MAC_10_10
, __IPHONE_7_0
); 
 121 size_t asl_core_str_to_size(char *s
) __OSX_AVAILABLE_STARTING(__MAC_10_10
, __IPHONE_7_0
); //TODO: 10_11 & 7_1 or 8_0 
 122 time_t asl_core_str_to_time(char *s
, uint32_t def_n
) __OSX_AVAILABLE_STARTING(__MAC_10_10
, __IPHONE_7_0
); //TODO: 10_11 & 7_1 or 8_0 
 123 void asl_core_time_to_str(time_t s
, char *str
, size_t len
) __OSX_AVAILABLE_STARTING(__MAC_10_10
, __IPHONE_7_0
); //TODO: 10_11 & 7_1 or 8_0 
 125 const char *asl_filesystem_path(uint32_t place
) __OSX_AVAILABLE_STARTING(__MAC_10_10
, __IPHONE_7_0
); 
 127 #endif /* __ASL_CORE_H__ */