X-Git-Url: http://the.earth.li/gitweb/?a=blobdiff_plain;f=marshal.h;h=8b487b4b4e0853e489af020a527eaf221ffe06a9;hb=refs%2Fheads%2Fmain;hp=432e51d817ea9959317ea27150a5100bb9cce5e4;hpb=5d25774c5cd9f80709f852f79bce26d582fad360;p=onak.git diff --git a/marshal.h b/marshal.h index 432e51d..8b487b4 100644 --- a/marshal.h +++ b/marshal.h @@ -2,6 +2,18 @@ * marshal.h - SKS compatible marshalling routines * * Copyright 2011 Jonathan McDowell + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; version 2 of the License. + * + * 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, see . */ #ifndef __MARSHAL_H__ @@ -20,7 +32,7 @@ * a 32 bit size of the forthcoming data in network byte order and * then the flattened byte representation of the key. */ -void marshal_publickey(int (*putchar_func)(void *ctx, size_t count, +void marshal_publickey(size_t (*putchar_func)(void *ctx, size_t count, void *c), void *ctx, const struct openpgp_publickey *key); @@ -33,7 +45,7 @@ void marshal_publickey(int (*putchar_func)(void *ctx, size_t count, * Returns an OpenPGP structure which is the unmarshalled result of * the input byte stream - ie the inverse of marshal_publickey. */ -struct openpgp_publickey *unmarshal_publickey(int (*getchar_func)(void *ctx, +struct openpgp_publickey *unmarshal_publickey(size_t (*getchar_func)(void *ctx, size_t count, void *c), void *ctx); @@ -48,7 +60,7 @@ struct openpgp_publickey *unmarshal_publickey(int (*getchar_func)(void *ctx, * a 32 bit size of the forthcoming data (16 bytes) in network byte order * and then the byte representation of the hash. */ -void marshal_skshash(int (*putchar_func)(void *ctx, size_t count, +void marshal_skshash(size_t (*putchar_func)(void *ctx, size_t count, void *c), void *ctx, const struct skshash *hash); @@ -61,7 +73,7 @@ void marshal_skshash(int (*putchar_func)(void *ctx, size_t count, * Returns an SKS hash structure which is the unmarshalled result of * the input byte stream - ie the inverse of marshal_skshash. */ -struct skshash *unmarshal_skshash(int (*getchar_func)(void *ctx, size_t count, +struct skshash *unmarshal_skshash(size_t (*getchar_func)(void *ctx, size_t count, void *c), void *ctx); @@ -74,7 +86,7 @@ struct skshash *unmarshal_skshash(int (*getchar_func)(void *ctx, size_t count, * Takes a string and marshals it to a byte stream - writes a 32 bit size * of the forthcoming data in network byte order and then the string. */ -void marshal_string(int (*putchar_func)(void *ctx, size_t count, +void marshal_string(size_t (*putchar_func)(void *ctx, size_t count, void *c), void *ctx, const char *string); @@ -87,7 +99,7 @@ void marshal_string(int (*putchar_func)(void *ctx, size_t count, * Returns a string which is the unmarshalled result of the input byte * stream - ie the inverse of marshal_string. */ -char *unmarshal_string(int (*getchar_func)(void *ctx, size_t count, +char *unmarshal_string(size_t (*getchar_func)(void *ctx, size_t count, void *c), void *ctx); @@ -104,10 +116,10 @@ char *unmarshal_string(int (*getchar_func)(void *ctx, size_t count, * calls marshal_func for each element in the array to provide the * marshalled contents. */ -void marshal_array(int (*putchar_func)(void *ctx, size_t count, +void marshal_array(size_t (*putchar_func)(void *ctx, size_t count, void *c), void *ctx, - void (*marshal_func)(int + void (*marshal_func)(size_t (*putchar_func)(void *ctx, size_t count, void *c), void *ctx, const void *item), @@ -125,10 +137,10 @@ void marshal_array(int (*putchar_func)(void *ctx, size_t count, * as determined by the supplied unmarshal_func function. ie the reverse * of marshal_array. */ -void **unmarshal_array(int (*getchar_func)(void *ctx, size_t count, +void **unmarshal_array(size_t (*getchar_func)(void *ctx, size_t count, void *c), void *ctx, - void *(*unmarshal_func)(int + void *(*unmarshal_func)(size_t (*getchar_func)(void *ctx, size_t count, void *c), void *ctx),