···23232424#include <stdint.h>
25252626-/* Check if a file looks like a FWU file */
2626+uint32_t afi_checksum(void *ptr, size_t size);
2727+/* Unpack an AFI file: the callback function will be called once for each file in the archive with
2828+ * its name and content. If the callback returns a nonzero value, the function will stop and return
2929+ * that value. Returns 0 on success */
3030+typedef int (*afi_extract_callback_t)(const char *name, uint8_t *buf, size_t size);
3131+int afi_unpack(uint8_t *buf, size_t size, afi_extract_callback_t cb);
3232+/* Check if a file looks like an AFI file */
2733bool afi_check(uint8_t *buf, size_t size);
28342935#endif /* __AFI_H__ */
···11+/***************************************************************************
22+ * __________ __ ___.
33+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
44+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
55+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
66+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
77+ * \/ \/ \/ \/ \/
88+ * $Id$
99+ *
1010+ * Copyright (C) 2017 Amaury Pouly
1111+ *
1212+ * This program is free software; you can redistribute it and/or
1313+ * modify it under the terms of the GNU General Public License
1414+ * as published by the Free Software Foundation; either version 2
1515+ * of the License, or (at your option) any later version.
1616+ *
1717+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
1818+ * KIND, either express or implied.
1919+ *
2020+ ****************************************************************************/
2121+#ifndef __FW_H__
2222+#define __FW_H__
2323+2424+#include <stdint.h>
2525+2626+/* Unpack an AFI file: the callback function will be called once for each file in the archive with
2727+ * its name and content. If the callback returns a nonzero value, the function will stop and return
2828+ * that value. Returns 0 on success */
2929+typedef int (*fw_extract_callback_t)(const char *name, uint8_t *buf, size_t size);
3030+int fw_unpack(uint8_t *buf, size_t size, fw_extract_callback_t cb);
3131+/* Check if a file looks like an AFI file */
3232+bool fw_check(uint8_t *buf, size_t size);
3333+3434+#endif /* __FW_H__ */