if (STRCMP(type, ==, "DALLOC_CTX")
|| STRCMP(type, ==, "sl_array_t")
+ || STRCMP(type, ==, "sl_filemeta_t")
|| STRCMP(type, ==, "sl_dict_t")) {
dd_dump(dd->dd_talloc_array[n], nestinglevel + 1);
} else if (STRCMP(type, ==, "uint64_t")) {
sl_bool_t bl;
memcpy(&bl, dd->dd_talloc_array[n], sizeof(sl_bool_t));
LOG(log_debug, logtype_sl, "%sbool: %s", neststrings[nestinglevel + 1], bl ? "true" : "false");
+ } else if (STRCMP(type, ==, "sl_nil_t")) {
+ LOG(log_debug, logtype_sl, "%snil", neststrings[nestinglevel + 1]);
} else if (STRCMP(type, ==, "sl_cnids_t")) {
sl_cnids_t cnids;
memcpy(&cnids, dd->dd_talloc_array[n], sizeof(sl_cnids_t));
LOG(log_debug, logtype_sl, "%sCNIDs: unkn1: 0x%" PRIx16 ", unkn2: 0x%" PRIx32,
neststrings[nestinglevel + 1], cnids.ca_unkn1, cnids.ca_context);
if (cnids.ca_cnids)
- dd_dump(cnids.ca_cnids, nestinglevel + 1);
+ dd_dump(cnids.ca_cnids, nestinglevel + 2);
}
}
LOG(log_debug, logtype_sl, "%s}", neststrings[nestinglevel]);
EC_NULL_LOG (int2 = dalloc_get(dd, "DALLOC_CTX", 6, "uint64_t", 1) );
LOG(log_debug, logtype_sl, "ctx1: 0x%" PRIx64 ", ctx2: 0x%" PRIx64, *int1, *int2);
-#if 0
/* now parse a real spotlight packet */
if (argc > 1) {
char ibuf[8192];
/* Now dump the whole thing */
dd_dump(query, 0);
}
-#endif
#if 0
/* packing */
int cnid_count = talloc_array_length(cnids->ca_cnids);
uint64_t id;
- SLVAL(toc_buf, *toc_idx * 8, sl_pack_tag(SQ_CPX_TYPE_CNIDS, (offset + SL_OFFSET_DELTA) / 8, cnid_count));
+ SLVAL(toc_buf, *toc_idx * 8, sl_pack_tag(SQ_CPX_TYPE_CNIDS, (offset + SL_OFFSET_DELTA) / 8, 0 /* cnid_count */));
SLVAL(buf, offset, sl_pack_tag(SQ_TYPE_COMPLEX, 1, *toc_idx + 1));
*toc_idx += 1;
offset += 8;
return offset;
}
+static int sl_pack_filemeta(sl_filemeta_t *fm, char *buf, int offset, char *toc_buf, int *toc_idx)
+{
+ int fmlen; /* lenght of filemeta */
+ int saveoff = offset + 8;
+
+ SLVAL(buf, offset, sl_pack_tag(SQ_TYPE_COMPLEX, 1, *toc_idx + 1));
+ offset += 16;
+
+ fmlen = sl_pack(fm, buf + offset);
+ offset += fmlen;
+
+ SLVAL(buf, saveoff, sl_pack_tag(SQ_TYPE_DATA, (fmlen / 8) + 1, 8 /* unknown meaning, but always 8 */));
+
+ SLVAL(toc_buf, *toc_idx * 8, sl_pack_tag(SQ_CPX_TYPE_FILEMETA, (offset + SL_OFFSET_DELTA) / 8, fmlen / 8));
+ *toc_idx += 1;
+
+ return offset;
+}
+
static int sl_pack_string(char **string, char *buf, int offset, char *toc_buf, int *toc_idx)
{
int len, octets, used_in_last_octet;
uint8_t mark_exists;
char *p;
int qlen, used_in_last_block, slen;
- sl_array_t *sl_arrary;
+ sl_array_t *sl_array;
sl_dict_t *sl_dict;
+ sl_filemeta_t *sl_fm;
switch (cpx_query_type) {
case SQ_CPX_TYPE_ARRAY:
- sl_arrary = talloc_zero(query, sl_array_t);
- EC_NEG1_LOG( roffset = sl_unpack_loop(sl_arrary, buf, offset, cpx_query_count, toc_offset, encoding) );
- dalloc_add(query, sl_arrary, sl_array_t);
+ sl_array = talloc_zero(query, sl_array_t);
+ EC_NEG1_LOG( roffset = sl_unpack_loop(sl_array, buf, offset, cpx_query_count, toc_offset, encoding) );
+ dalloc_add(query, sl_array, sl_array_t);
break;
case SQ_CPX_TYPE_DICT:
if (qlen <= 8) {
EC_FAIL_LOG("SQ_CPX_TYPE_FILEMETA: query_length <= 8: %d", qlen);
} else {
- EC_NEG1_LOG( sl_unpack(query, buf + offset + 8) );
+ sl_fm = talloc_zero(query, sl_filemeta_t);
+ EC_NEG1_LOG( sl_unpack(sl_fm, buf + offset + 8) );
+ dalloc_add(query, sl_fm, sl_filemeta_t);
}
roffset += qlen;
break;