Commit 56c0f457 authored by Dustin L. Howett's avatar Dustin L. Howett

Add generic taglist_to_container for dady.

parent a73c01f2
...@@ -121,7 +121,7 @@ uint32_t abprinttag(uint8_t **buf, uint32_t tagtype, uint32_t len, void *data, b ...@@ -121,7 +121,7 @@ uint32_t abprinttag(uint8_t **buf, uint32_t tagtype, uint32_t len, void *data, b
return bprinttag(*buf, tagtype, len, data, checksum); return bprinttag(*buf, tagtype, len, data, checksum);
} }
uint8_t *taglist_to_dady(struct tag_info *taglist, uint32_t ntags, uint32_t *outlen) { uint8_t *taglist_to_container(struct tag_info *taglist, uint32_t ntags, uint32_t tagtype, bool checksum, uint32_t *outlen) {
uint32_t n = 0; uint32_t n = 0;
for(unsigned int i = 0; i < ntags; i++) { for(unsigned int i = 0; i < ntags; i++) {
n += bprinttag(NULL, 0, taglist[i].len, NULL, false); n += bprinttag(NULL, 0, taglist[i].len, NULL, false);
...@@ -135,9 +135,13 @@ uint8_t *taglist_to_dady(struct tag_info *taglist, uint32_t ntags, uint32_t *out ...@@ -135,9 +135,13 @@ uint8_t *taglist_to_dady(struct tag_info *taglist, uint32_t ntags, uint32_t *out
} }
uint8_t *dadytag; uint8_t *dadytag;
*outlen = abprinttag(&dadytag, TAG_ID_DADY, contentlen, container, false); *outlen = abprinttag(&dadytag, tagtype, contentlen, container, checksum);
free(container); free(container);
return dadytag; return dadytag;
} }
uint8_t *taglist_to_dady(struct tag_info *taglist, uint32_t ntags, uint32_t *outlen) {
return taglist_to_container(taglist, ntags, TAG_ID_DADY, true, outlen);
}
// vim:ft=objc // vim:ft=objc
...@@ -49,6 +49,7 @@ struct tag_info { ...@@ -49,6 +49,7 @@ struct tag_info {
void *bufp; void *bufp;
}; };
uint8_t *taglist_to_container(struct tag_info *taglist, uint32_t ntags, uint32_t tagtype, bool checksum, uint32_t *outlen);
uint8_t *taglist_to_dady(struct tag_info *taglist, uint32_t ntags, uint32_t *outlen); uint8_t *taglist_to_dady(struct tag_info *taglist, uint32_t ntags, uint32_t *outlen);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment