uint16_t pos;
uint16_t count;
} knot_pktsection_t;
-struct knot_compr {
+typedef struct knot_compr {
uint8_t *wire;
knot_rrinfo_t *rrinfo;
struct {
uint16_t pos;
uint8_t labels;
} suffix;
-};
-typedef struct knot_compr knot_compr_t;
+} knot_compr_t;
struct knot_pkt {
uint8_t *wire;
size_t size;
_Bool NO_NS_FOUND : 1;
_Bool PKT_IS_SANE : 1;
};
-struct ranked_rr_array_entry {
+typedef struct ranked_rr_array_entry {
uint32_t qry_uid;
uint8_t rank;
uint8_t revalidation_cnt;
_Bool in_progress : 1;
_Bool dont_cache : 1;
knot_rrset_t *rr;
-};
-typedef struct ranked_rr_array_entry ranked_rr_array_entry_t;
+} ranked_rr_array_entry_t;
typedef struct {
ranked_rr_array_entry_t **at;
size_t len;
struct timeval checkpoint_walltime;
uint64_t checkpoint_monotime;
};
-struct kr_layer {
+typedef struct kr_layer {
int state;
struct kr_request *req;
const struct kr_layer_api *api;
knot_pkt_t *pkt;
struct sockaddr *dst;
_Bool is_stream;
-};
-typedef struct kr_layer kr_layer_t;
-struct kr_layer_api {
+} kr_layer_t;
+typedef struct kr_layer_api {
int (*begin)(kr_layer_t *);
int (*reset)(kr_layer_t *);
int (*finish)(kr_layer_t *);
int (*answer_finalize)(kr_layer_t *);
void *data;
int cb_slots[];
-};
-typedef struct kr_layer_api kr_layer_api_t;
+} kr_layer_api_t;
struct kr_prop {
kr_prop_cb *cb;
const char *name;
} zs_loc_t;
typedef enum {ZS_STATE_NONE, ZS_STATE_DATA, ZS_STATE_ERROR, ZS_STATE_INCLUDE, ZS_STATE_EOF, ZS_STATE_STOP} zs_state_t;
typedef struct zs_scanner zs_scanner_t;
-struct zs_scanner {
+typedef struct zs_scanner {
int cs;
int top;
int stack[16];
uint16_t r_type;
uint32_t r_data_length;
uint8_t r_data[65535];
-};
+} zs_scanner_t;
void zs_deinit(zs_scanner_t *);
int zs_init(zs_scanner_t *, const char *, const uint16_t, const uint32_t);
int zs_parse_record(zs_scanner_t *);
"
${CDEFS} ${LIBKRES} types <<-EOF
- knot_pkt_t
+ #knot_pkt_t contains indirect recursion
+ typedef knot_pkt_t
knot_edns_options_t
knot_pktsection_t
- struct knot_compr
knot_compr_t
struct knot_pkt
# lib/generic/
map_t
- trie_t
+ #trie_t inside is private to libknot
+ typedef trie_t
# libkres
struct kr_qflags
- struct ranked_rr_array_entry
ranked_rr_array_entry_t
ranked_rr_array_t
struct kr_zonecut
struct kr_cdb_stats
struct kr_cache
# lib/layer.h
- struct kr_layer
kr_layer_t
- struct kr_layer_api
kr_layer_api_t
# lib/module.h
struct kr_prop
zs_apl_t
zs_loc_t
zs_state_t
+ #zs_scanner_t contains recursion
+ typedef zs_scanner_t
zs_scanner_t
- struct zs_scanner
EOF
${CDEFS} libzscanner functions <<-EOF
zs_deinit
echo "Usage: $0 libkres (types|functions)" >&2
echo " and input identifiers, one per line." >&2
echo " You need debug symbols in the library." >&2
+ echo
+ echo " If you call this on a type that's a typedef, it gets expanded." >&2
+ echo " To avoid that, prefix the identifier with 'typedef '." >&2
exit 1
fi
output="$("${GDB[@]}" --ex "ptype $ident" \
| sed '0,/^type = /s/^type = /\n/; $ s/$/;/')"
;;
- *)
- output="$("${GDB[@]}" --ex "info types ^$ident\$" \
+ typedef\ *) # typedef that shouldn't be expanded
+ output="$("${GDB[@]}" --ex "info types ^"$(echo "$ident" | sed 's/^typedef //')"\$" \
| sed -e '0,/^File .*:$/ d' -e '/^File .*:$/,$ d')"
# we need to stop early to remove ^^ multiple matches
;;
+ *) # we assume it's a typedef that should be expanded
+ output="$("${GDB[@]}" --ex "ptype $ident" \
+ | sed "0,/^type = /s/^type = /typedef /; $ s/$/ $ident;/")"
+ ;;
esac
fi
# LuaJIT FFI blows up on "uint" type