blob: 565cd5f0539cdbbe506e1b2209f05863c0027b7d [file] [log] [blame]
/*
* blob - generic type for storing an array and a length.
*
* This file initially created by Google, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __BLOB_H
#define __BLOB_H
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Generic byte array, with length.
*/
struct blob {
size_t len;
char *data;
char buffer[0];
};
int blob_new(struct blob **blob, size_t len, const char *data);
int blob_new_from_hex(struct blob **blob, const char *hex);
void blob_free(struct blob *blob);
#ifdef __cplusplus
}
#endif
#endif /* __BLOB_H */