|
Packit |
5f9837 |
/*
|
|
Packit |
5f9837 |
Unix SMB/CIFS implementation.
|
|
Packit |
5f9837 |
DATA BLOB
|
|
Packit |
5f9837 |
|
|
Packit |
5f9837 |
This program is free software; you can redistribute it and/or modify
|
|
Packit |
5f9837 |
it under the terms of the GNU General Public License as published by
|
|
Packit |
5f9837 |
the Free Software Foundation; either version 3 of the License, or
|
|
Packit |
5f9837 |
(at your option) any later version.
|
|
Packit |
5f9837 |
|
|
Packit |
5f9837 |
This program is distributed in the hope that it will be useful,
|
|
Packit |
5f9837 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
5f9837 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
5f9837 |
GNU General Public License for more details.
|
|
Packit |
5f9837 |
|
|
Packit |
5f9837 |
You should have received a copy of the GNU General Public License
|
|
Packit |
5f9837 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
Packit |
5f9837 |
*/
|
|
Packit |
5f9837 |
|
|
Packit |
5f9837 |
/* This is a public header file that is installed as part of Samba.
|
|
Packit |
5f9837 |
* If you remove any functions or change their signature, update
|
|
Packit |
5f9837 |
* the so version number. */
|
|
Packit |
5f9837 |
|
|
Packit |
5f9837 |
#ifndef _SAMBA_DATABLOB_H_
|
|
Packit |
5f9837 |
#define _SAMBA_DATABLOB_H_
|
|
Packit |
5f9837 |
|
|
Packit |
5f9837 |
#include <talloc.h>
|
|
Packit |
5f9837 |
#include <stdint.h>
|
|
Packit |
5f9837 |
|
|
Packit |
5f9837 |
/* used to hold an arbitrary blob of data */
|
|
Packit |
5f9837 |
typedef struct datablob {
|
|
Packit |
5f9837 |
uint8_t *data;
|
|
Packit |
5f9837 |
size_t length;
|
|
Packit |
5f9837 |
} DATA_BLOB;
|
|
Packit |
5f9837 |
|
|
Packit |
5f9837 |
struct data_blob_list_item {
|
|
Packit |
5f9837 |
struct data_blob_list_item *prev,*next;
|
|
Packit |
5f9837 |
DATA_BLOB blob;
|
|
Packit |
5f9837 |
};
|
|
Packit |
5f9837 |
|
|
Packit |
5f9837 |
/* by making struct ldb_val and DATA_BLOB the same, we can simplify
|
|
Packit |
5f9837 |
a fair bit of code */
|
|
Packit |
5f9837 |
#define ldb_val datablob
|
|
Packit |
5f9837 |
|
|
Packit |
5f9837 |
#define data_blob(ptr, size) data_blob_named(ptr, size, "DATA_BLOB: "__location__)
|
|
Packit |
5f9837 |
#define data_blob_talloc(ctx, ptr, size) data_blob_talloc_named(ctx, ptr, size, "DATA_BLOB: "__location__)
|
|
Packit |
5f9837 |
#define data_blob_dup_talloc(ctx, blob) data_blob_talloc_named(ctx, (blob)->data, (blob)->length, "DATA_BLOB: "__location__)
|
|
Packit |
5f9837 |
|
|
Packit |
5f9837 |
/**
|
|
Packit |
5f9837 |
construct a data blob, must be freed with data_blob_free()
|
|
Packit |
5f9837 |
you can pass NULL for p and get a blank data blob
|
|
Packit |
5f9837 |
**/
|
|
Packit |
5f9837 |
DATA_BLOB data_blob_named(const void *p, size_t length, const char *name);
|
|
Packit |
5f9837 |
|
|
Packit |
5f9837 |
/**
|
|
Packit |
5f9837 |
construct a data blob, using supplied TALLOC_CTX
|
|
Packit |
5f9837 |
**/
|
|
Packit |
5f9837 |
DATA_BLOB data_blob_talloc_named(TALLOC_CTX *mem_ctx, const void *p, size_t length, const char *name);
|
|
Packit |
5f9837 |
|
|
Packit |
5f9837 |
/**
|
|
Packit |
5f9837 |
free a data blob
|
|
Packit |
5f9837 |
**/
|
|
Packit |
5f9837 |
void data_blob_free(DATA_BLOB *d);
|
|
Packit |
5f9837 |
|
|
Packit |
5f9837 |
extern const DATA_BLOB data_blob_null;
|
|
Packit |
5f9837 |
|
|
Packit |
5f9837 |
#endif /* _SAMBA_DATABLOB_H_ */
|