ex
Fork of mbed-os-example-mbed5-blinky by
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/ota/inc/decompress.h@47:9e361da97763, 2017-07-18 (annotated)
- Committer:
- TMBOY
- Date:
- Tue Jul 18 16:54:45 2017 +0800
- Revision:
- 47:9e361da97763
?
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| TMBOY | 47:9e361da97763 | 1 | |
| TMBOY | 47:9e361da97763 | 2 | #ifndef _MBED_PACK_DECRYPTION_ |
| TMBOY | 47:9e361da97763 | 3 | #define _MBED_PACK_DECRYPTION_ |
| TMBOY | 47:9e361da97763 | 4 | |
| TMBOY | 47:9e361da97763 | 5 | #include <stdint.h> |
| TMBOY | 47:9e361da97763 | 6 | #include "pack_include.h" |
| TMBOY | 47:9e361da97763 | 7 | #include "zliblite/zlib.h" |
| TMBOY | 47:9e361da97763 | 8 | #include "IOtaUpdater.h" |
| TMBOY | 47:9e361da97763 | 9 | |
| TMBOY | 47:9e361da97763 | 10 | typedef struct _decompress_context_ { |
| TMBOY | 47:9e361da97763 | 11 | // internal_footprint |
| TMBOY | 47:9e361da97763 | 12 | uint32_t stream_recieved_sz; // current size of recieved stream |
| TMBOY | 47:9e361da97763 | 13 | uint32_t stream_processed_sz; // current size of processed stream |
| TMBOY | 47:9e361da97763 | 14 | |
| TMBOY | 47:9e361da97763 | 15 | //cache meta data |
| TMBOY | 47:9e361da97763 | 16 | unsigned int meta_size; |
| TMBOY | 47:9e361da97763 | 17 | unsigned int meta_stored_size; |
| TMBOY | 47:9e361da97763 | 18 | char *meta_data; |
| TMBOY | 47:9e361da97763 | 19 | |
| TMBOY | 47:9e361da97763 | 20 | //module data write offset |
| TMBOY | 47:9e361da97763 | 21 | unsigned int write_offset; |
| TMBOY | 47:9e361da97763 | 22 | // zlib stream object |
| TMBOY | 47:9e361da97763 | 23 | z_streamp strmp; |
| TMBOY | 47:9e361da97763 | 24 | |
| TMBOY | 47:9e361da97763 | 25 | } decompress_context_t; |
| TMBOY | 47:9e361da97763 | 26 | |
| TMBOY | 47:9e361da97763 | 27 | /** |
| TMBOY | 47:9e361da97763 | 28 | * |
| TMBOY | 47:9e361da97763 | 29 | * package decompress |
| TMBOY | 47:9e361da97763 | 30 | * |
| TMBOY | 47:9e361da97763 | 31 | * \return decompress context |
| TMBOY | 47:9e361da97763 | 32 | */ |
| TMBOY | 47:9e361da97763 | 33 | void* mbed_zlibstream_decompress_init(); |
| TMBOY | 47:9e361da97763 | 34 | |
| TMBOY | 47:9e361da97763 | 35 | |
| TMBOY | 47:9e361da97763 | 36 | /** |
| TMBOY | 47:9e361da97763 | 37 | * |
| TMBOY | 47:9e361da97763 | 38 | * package decompress process |
| TMBOY | 47:9e361da97763 | 39 | * |
| TMBOY | 47:9e361da97763 | 40 | * \param ctx decompress context |
| TMBOY | 47:9e361da97763 | 41 | * \param buffer data to decompress |
| TMBOY | 47:9e361da97763 | 42 | * \param bufferSZ buffer size |
| TMBOY | 47:9e361da97763 | 43 | * \param lFileHandle fs file index |
| TMBOY | 47:9e361da97763 | 44 | * |
| TMBOY | 47:9e361da97763 | 45 | * \return process state |
| TMBOY | 47:9e361da97763 | 46 | */ |
| TMBOY | 47:9e361da97763 | 47 | int mbed_zlibstream_decompress_process(void *verify_cxt, decompress_context_t* ctx, unsigned char* buffer, uint32_t bufferSZ, |
| TMBOY | 47:9e361da97763 | 48 | struct IOtaUpdater *updater, void *update_cxt); |
| TMBOY | 47:9e361da97763 | 49 | |
| TMBOY | 47:9e361da97763 | 50 | |
| TMBOY | 47:9e361da97763 | 51 | /** |
| TMBOY | 47:9e361da97763 | 52 | * |
| TMBOY | 47:9e361da97763 | 53 | * package decompress uninit |
| TMBOY | 47:9e361da97763 | 54 | * |
| TMBOY | 47:9e361da97763 | 55 | * \param ctx decompress context |
| TMBOY | 47:9e361da97763 | 56 | * |
| TMBOY | 47:9e361da97763 | 57 | */ |
| TMBOY | 47:9e361da97763 | 58 | void mbed_zlibstream_decompress_uninit(decompress_context_t* ctx); |
| TMBOY | 47:9e361da97763 | 59 | |
| TMBOY | 47:9e361da97763 | 60 | |
| TMBOY | 47:9e361da97763 | 61 | |
| TMBOY | 47:9e361da97763 | 62 | |
| TMBOY | 47:9e361da97763 | 63 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| TMBOY | 47:9e361da97763 | 64 | |
| TMBOY | 47:9e361da97763 | 65 | |
| TMBOY | 47:9e361da97763 | 66 | |
| TMBOY | 47:9e361da97763 | 67 | |
| TMBOY | 47:9e361da97763 | 68 | |
| TMBOY | 47:9e361da97763 | 69 | // for test |
| TMBOY | 47:9e361da97763 | 70 | //void mbed_decompress_test(); |
| TMBOY | 47:9e361da97763 | 71 | |
| TMBOY | 47:9e361da97763 | 72 | |
| TMBOY | 47:9e361da97763 | 73 | #endif |
| TMBOY | 47:9e361da97763 | 74 |
