#include <errno.h>#include <inttypes.h>#include <stdbool.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <strings.h>#include <talloc.h>#include <atalk/byteorder.h>#include <atalk/dalloc.h>#include <atalk/dsi.h>#include <atalk/errchk.h>#include <atalk/logger.h>#include <atalk/netatalk_conf.h>#include <atalk/spotlight.h>#include <atalk/util.h>#include <atalk/volume.h>Macros | |
| #define | MAX_SLQ_DAT (DSI_DATASIZ - 64) |
| #define | MAX_SLQ_TOC 8192 |
| #define | SPOTLIGHT_TIME_DELTA INT64_C(280878921600U) |
| #define | SQ_TYPE_NULL 0x0000 |
| #define | SQ_TYPE_COMPLEX 0x0200 |
| #define | SQ_TYPE_INT64 0x8400 |
| #define | SQ_TYPE_BOOL 0x0100 |
| #define | SQ_TYPE_FLOAT 0x8500 |
| #define | SQ_TYPE_DATA 0x0700 |
| #define | SQ_TYPE_CNIDS 0x8700 |
| #define | SQ_TYPE_UUID 0x0e00 |
| #define | SQ_TYPE_DATE 0x8600 |
| #define | SQ_TYPE_TOC 0x8800 |
| #define | SQ_CPX_TYPE_ARRAY 0x0a00 |
| #define | SQ_CPX_TYPE_STRING 0x0c00 |
| #define | SQ_CPX_TYPE_UTF16_STRING 0x1c00 |
| #define | SQ_CPX_TYPE_DICT 0x0d00 |
| #define | SQ_CPX_TYPE_CNIDS 0x1a00 |
| #define | SQ_CPX_TYPE_FILEMETA 0x1b00 |
| #define | SUBQ_SAFETY_LIM 20 |
| #define | SL_OFFSET_DELTA 16 |
Functions | |
| static int | sl_pack_loop (DALLOC_CTX *query, char *buf, int offset, char *toc_buf, int *toc_idx) |
| static int | sl_unpack_loop (DALLOC_CTX *query, const char *buf, int offset, uint count, const uint toc_offset, const uint encoding) |
| static int | sivalc (char *buf, off_t off, off_t maxoff, uint32_t val) |
| static int | slvalc (char *buf, off_t off, off_t maxoff, uint64_t val) |
| static uint | spotlight_get_utf16_string_encoding (const char *buf, int offset, int query_length, uint encoding) |
| Returns the UTF-16 string encoding, by checking the 2-byte byte order mark. | |
| static uint64_t | sl_pack_tag (uint16_t type, uint16_t size_or_count, uint32_t val) |
| static int | sl_pack_float (double d, char *buf, int offset) |
| static int | sl_pack_uint64 (uint64_t u, char *buf, int offset) |
| static int | sl_pack_bool (sl_bool_t bl, char *buf, int offset) |
| static int | sl_pack_nil (char *buf, int offset) |
| static int | sl_pack_date (sl_time_t t, char *buf, int offset) |
| static int | sl_pack_uuid (sl_uuid_t *uuid, char *buf, int offset) |
| static int | sl_pack_CNID (sl_cnids_t *cnids, char *buf, int offset, char *toc_buf, int *toc_idx) |
| static int | sl_pack_array (sl_array_t *array, char *buf, int offset, char *toc_buf, int *toc_idx) |
| static int | sl_pack_dict (sl_array_t *dict, char *buf, int offset, char *toc_buf, int *toc_idx) |
| static int | sl_pack_filemeta (sl_filemeta_t *fm, char *buf, int offset, char *toc_buf, int *toc_idx) |
| static int | sl_pack_string (char *s, char *buf, int offset, char *toc_buf, int *toc_idx) |
| static uint64_t | sl_unpack_uint64 (const char *buf, int offset, uint encoding) |
| static int | sl_unpack_ints (DALLOC_CTX *query, const char *buf, int offset, uint encoding) |
| static int | sl_unpack_date (DALLOC_CTX *query, const char *buf, int offset, uint encoding) |
| static int | sl_unpack_uuid (DALLOC_CTX *query, const char *buf, int offset, uint encoding) |
| static int | sl_unpack_floats (DALLOC_CTX *query, const char *buf, int offset, uint encoding) |
| static int | sl_unpack_CNID (DALLOC_CTX *query, const char *buf, int offset, int length, uint encoding) |
| static const char * | spotlight_get_qtype_string (uint64_t query_type) |
| static const char * | spotlight_get_cpx_qtype_string (uint64_t cpx_query_type) |
| static int | sl_unpack_cpx (DALLOC_CTX *query, const char *buf, const int offset, uint cpx_query_type, uint cpx_query_count, const uint toc_offset, const uint encoding) |
| int | sl_pack (DALLOC_CTX *query, char *buf) |
| int | sl_unpack (DALLOC_CTX *query, const char *buf) |
| #define MAX_SLQ_DAT (DSI_DATASIZ - 64) |
| #define MAX_SLQ_TOC 8192 |
| #define SL_OFFSET_DELTA 16 |
| #define SPOTLIGHT_TIME_DELTA INT64_C(280878921600U) |
Spotlight epoch is UNIX epoch minus SPOTLIGHT_TIME_DELTA
| #define SQ_CPX_TYPE_ARRAY 0x0a00 |
| #define SQ_CPX_TYPE_CNIDS 0x1a00 |
| #define SQ_CPX_TYPE_DICT 0x0d00 |
| #define SQ_CPX_TYPE_FILEMETA 0x1b00 |
| #define SQ_CPX_TYPE_STRING 0x0c00 |
| #define SQ_CPX_TYPE_UTF16_STRING 0x1c00 |
| #define SQ_TYPE_BOOL 0x0100 |
| #define SQ_TYPE_CNIDS 0x8700 |
| #define SQ_TYPE_COMPLEX 0x0200 |
| #define SQ_TYPE_DATA 0x0700 |
| #define SQ_TYPE_DATE 0x8600 |
| #define SQ_TYPE_FLOAT 0x8500 |
| #define SQ_TYPE_INT64 0x8400 |
| #define SQ_TYPE_NULL 0x0000 |
| #define SQ_TYPE_TOC 0x8800 |
| #define SQ_TYPE_UUID 0x0e00 |
| #define SUBQ_SAFETY_LIM 20 |
|
static |
| int sl_pack | ( | DALLOC_CTX * | query, |
| char * | buf ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| int sl_unpack | ( | DALLOC_CTX * | query, |
| const char * | buf ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Returns the UTF-16 string encoding, by checking the 2-byte byte order mark.