librpc: Add ndr_cab_get_compression() for Cabinet compression evaluation
authorGünther Deschner <gd@samba.org>
Mon, 19 Sep 2016 22:20:18 +0000 (00:20 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 24 Nov 2016 19:24:26 +0000 (20:24 +0100)
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
librpc/ndr/ndr_cab.c
librpc/ndr/ndr_cab.h

index 3923aece6d089c932818a148e4890650bbff9386..0d2b36b3249b86f135930ba003cd4d38e083ae5c 100644 (file)
@@ -138,6 +138,15 @@ static uint32_t ndr_size_cab_file(const struct cab_file *r)
        return size;
 }
 
+enum cf_compress_type ndr_cab_get_compression(const struct cab_file *r)
+{
+       if (r->cfheader.cFolders == 0) {
+               return CF_COMPRESS_NONE;
+       }
+
+       return r->cffolders[0].typeCompress;
+}
+
 _PUBLIC_ enum ndr_err_code ndr_push_cab_file(struct ndr_push *ndr, int ndr_flags, const struct cab_file *r)
 {
        uint32_t cntr_cffolders_0;
index 59dbc9914421ec168dd7b40f049d8f3a225ce703..79871530eb911ea20b641088e878dcd742930623 100644 (file)
@@ -21,3 +21,4 @@
 
 uint32_t ndr_count_cfdata(const struct cab_file *r);
 uint32_t ndr_cab_generate_checksum(const struct CFDATA *r);
+enum cf_compress_type ndr_cab_get_compression(const struct cab_file *r);