netatalk  4.4.0dev
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
spotlight_marshalling.c File Reference
#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)
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)

Macro Definition Documentation

◆ MAX_SLQ_DAT

#define MAX_SLQ_DAT   (DSI_DATASIZ - 64)

◆ MAX_SLQ_TOC

#define MAX_SLQ_TOC   8192

◆ SL_OFFSET_DELTA

#define SL_OFFSET_DELTA   16

◆ SPOTLIGHT_TIME_DELTA

#define SPOTLIGHT_TIME_DELTA   INT64_C(280878921600U)

◆ SQ_CPX_TYPE_ARRAY

#define SQ_CPX_TYPE_ARRAY   0x0a00

◆ SQ_CPX_TYPE_CNIDS

#define SQ_CPX_TYPE_CNIDS   0x1a00

◆ SQ_CPX_TYPE_DICT

#define SQ_CPX_TYPE_DICT   0x0d00

◆ SQ_CPX_TYPE_FILEMETA

#define SQ_CPX_TYPE_FILEMETA   0x1b00

◆ SQ_CPX_TYPE_STRING

#define SQ_CPX_TYPE_STRING   0x0c00

◆ SQ_CPX_TYPE_UTF16_STRING

#define SQ_CPX_TYPE_UTF16_STRING   0x1c00

◆ SQ_TYPE_BOOL

#define SQ_TYPE_BOOL   0x0100

◆ SQ_TYPE_CNIDS

#define SQ_TYPE_CNIDS   0x8700

◆ SQ_TYPE_COMPLEX

#define SQ_TYPE_COMPLEX   0x0200

◆ SQ_TYPE_DATA

#define SQ_TYPE_DATA   0x0700

◆ SQ_TYPE_DATE

#define SQ_TYPE_DATE   0x8600

◆ SQ_TYPE_FLOAT

#define SQ_TYPE_FLOAT   0x8500

◆ SQ_TYPE_INT64

#define SQ_TYPE_INT64   0x8400

◆ SQ_TYPE_NULL

#define SQ_TYPE_NULL   0x0000

◆ SQ_TYPE_TOC

#define SQ_TYPE_TOC   0x8800

◆ SQ_TYPE_UUID

#define SQ_TYPE_UUID   0x0e00

◆ SUBQ_SAFETY_LIM

#define SUBQ_SAFETY_LIM   20

Function Documentation

◆ sivalc()

int sivalc ( char * buf,
off_t off,
off_t maxoff,
uint32_t val )
static

◆ sl_pack()

int sl_pack ( DALLOC_CTX * query,
char * buf )

◆ sl_pack_array()

int sl_pack_array ( sl_array_t * array,
char * buf,
int offset,
char * toc_buf,
int * toc_idx )
static

◆ sl_pack_bool()

int sl_pack_bool ( sl_bool_t bl,
char * buf,
int offset )
static

◆ sl_pack_CNID()

int sl_pack_CNID ( sl_cnids_t * cnids,
char * buf,
int offset,
char * toc_buf,
int * toc_idx )
static

◆ sl_pack_date()

int sl_pack_date ( sl_time_t t,
char * buf,
int offset )
static

◆ sl_pack_dict()

int sl_pack_dict ( sl_array_t * dict,
char * buf,
int offset,
char * toc_buf,
int * toc_idx )
static

◆ sl_pack_filemeta()

int sl_pack_filemeta ( sl_filemeta_t * fm,
char * buf,
int offset,
char * toc_buf,
int * toc_idx )
static

◆ sl_pack_float()

int sl_pack_float ( double d,
char * buf,
int offset )
static

◆ sl_pack_loop()

int sl_pack_loop ( DALLOC_CTX * query,
char * buf,
int offset,
char * toc_buf,
int * toc_idx )
static

◆ sl_pack_nil()

int sl_pack_nil ( char * buf,
int offset )
static

◆ sl_pack_string()

int sl_pack_string ( char * s,
char * buf,
int offset,
char * toc_buf,
int * toc_idx )
static

◆ sl_pack_tag()

uint64_t sl_pack_tag ( uint16_t type,
uint16_t size_or_count,
uint32_t val )
static

◆ sl_pack_uint64()

int sl_pack_uint64 ( uint64_t u,
char * buf,
int offset )
static

◆ sl_pack_uuid()

int sl_pack_uuid ( sl_uuid_t * uuid,
char * buf,
int offset )
static

◆ sl_unpack()

int sl_unpack ( DALLOC_CTX * query,
const char * buf )

◆ sl_unpack_CNID()

int sl_unpack_CNID ( DALLOC_CTX * query,
const char * buf,
int offset,
int length,
uint encoding )
static

◆ sl_unpack_cpx()

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 )
static

◆ sl_unpack_date()

int sl_unpack_date ( DALLOC_CTX * query,
const char * buf,
int offset,
uint encoding )
static

◆ sl_unpack_floats()

int sl_unpack_floats ( DALLOC_CTX * query,
const char * buf,
int offset,
uint encoding )
static

◆ sl_unpack_ints()

int sl_unpack_ints ( DALLOC_CTX * query,
const char * buf,
int offset,
uint encoding )
static

◆ sl_unpack_loop()

int sl_unpack_loop ( DALLOC_CTX * query,
const char * buf,
int offset,
uint count,
const uint toc_offset,
const uint encoding )
static

◆ sl_unpack_uint64()

uint64_t sl_unpack_uint64 ( const char * buf,
int offset,
uint encoding )
static

◆ sl_unpack_uuid()

int sl_unpack_uuid ( DALLOC_CTX * query,
const char * buf,
int offset,
uint encoding )
static

◆ slvalc()

int slvalc ( char * buf,
off_t off,
off_t maxoff,
uint64_t val )
static

◆ spotlight_get_cpx_qtype_string()

const char * spotlight_get_cpx_qtype_string ( uint64_t cpx_query_type)
static

◆ spotlight_get_qtype_string()

const char * spotlight_get_qtype_string ( uint64_t query_type)
static

◆ spotlight_get_utf16_string_encoding()

uint spotlight_get_utf16_string_encoding ( const char * buf,
int offset,
int query_length,
uint encoding )
static