ex

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers decompress.h Source File

decompress.h

00001 
00002 #ifndef _MBED_PACK_DECRYPTION_
00003 #define _MBED_PACK_DECRYPTION_
00004 
00005 #include <stdint.h>
00006 #include "pack_include.h"
00007 #include "zliblite/zlib.h"
00008 #include "IOtaUpdater.h"
00009 
00010 typedef struct _decompress_context_ {
00011     // internal_footprint
00012     uint32_t stream_recieved_sz;    // current size of recieved stream
00013     uint32_t stream_processed_sz;   // current size of processed stream
00014 
00015     //cache meta data
00016     unsigned int meta_size;
00017     unsigned int meta_stored_size;
00018     char *meta_data;
00019 
00020     //module data write offset
00021     unsigned int write_offset;
00022     // zlib stream object
00023     z_streamp strmp;
00024 
00025 } decompress_context_t;
00026 
00027 /**
00028  *
00029  * package decompress
00030  *
00031  * \return decompress context
00032  */
00033 void* mbed_zlibstream_decompress_init();
00034 
00035 
00036 /**
00037  *
00038  * package decompress process
00039  *
00040  * \param ctx decompress context
00041  * \param buffer data to decompress
00042  * \param bufferSZ buffer size
00043  * \param lFileHandle fs file index
00044  *
00045  * \return process state
00046  */
00047 int mbed_zlibstream_decompress_process(void *verify_cxt, decompress_context_t* ctx, unsigned char* buffer, uint32_t bufferSZ,
00048         struct IOtaUpdater *updater, void *update_cxt);
00049 
00050 
00051 /**
00052  *
00053  * package decompress uninit
00054  *
00055  * \param ctx decompress context
00056  *
00057  */
00058 void mbed_zlibstream_decompress_uninit(decompress_context_t* ctx);
00059 
00060 
00061 
00062 
00063 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
00064 
00065 
00066 
00067 
00068 
00069 // for test
00070 //void mbed_decompress_test();
00071 
00072 
00073 #endif
00074