diff options
Diffstat (limited to 'source4/heimdal/lib/krb5/data.c')
-rw-r--r-- | source4/heimdal/lib/krb5/data.c | 100 |
1 files changed, 98 insertions, 2 deletions
diff --git a/source4/heimdal/lib/krb5/data.c b/source4/heimdal/lib/krb5/data.c index 2ece85bdb3..eda1a8b259 100644 --- a/source4/heimdal/lib/krb5/data.c +++ b/source4/heimdal/lib/krb5/data.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan + * Copyright (c) 1997 - 2007 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -33,7 +33,15 @@ #include "krb5_locl.h" -RCSID("$Id: data.c 20039 2007-01-23 20:34:01Z lha $"); +RCSID("$Id: data.c 22064 2007-11-11 16:28:14Z lha $"); + +/** + * Reset the (potentially uninitalized) krb5_data structure. + * + * @param p krb5_data to reset. + * + * @ingroup krb5 + */ void KRB5_LIB_FUNCTION krb5_data_zero(krb5_data *p) @@ -42,6 +50,15 @@ krb5_data_zero(krb5_data *p) p->data = NULL; } +/** + * Free the content of krb5_data structure, its ok to free a zeroed + * structure. When done, the structure will be zeroed. + * + * @param p krb5_data to free. + * + * @ingroup krb5 + */ + void KRB5_LIB_FUNCTION krb5_data_free(krb5_data *p) { @@ -50,12 +67,30 @@ krb5_data_free(krb5_data *p) krb5_data_zero(p); } +/** + * Same as krb5_data_free(). + * + * @param context Kerberos 5 context. + * @param data krb5_data to free. + * + * @ingroup krb5 + */ + void KRB5_LIB_FUNCTION krb5_free_data_contents(krb5_context context, krb5_data *data) { krb5_data_free(data); } +/** + * Free krb5_data (and its content). + * + * @param context Kerberos 5 context. + * @param p krb5_data to free. + * + * @ingroup krb5 + */ + void KRB5_LIB_FUNCTION krb5_free_data(krb5_context context, krb5_data *p) @@ -64,6 +99,18 @@ krb5_free_data(krb5_context context, free(p); } +/** + * Allocate data of and krb5_data. + * + * @param p krb5_data to free. + * @param len size to allocate. + * + * @return Returns 0 to indicate success. Otherwise an kerberos et + * error code is returned. + * + * @ingroup krb5 + */ + krb5_error_code KRB5_LIB_FUNCTION krb5_data_alloc(krb5_data *p, int len) { @@ -74,6 +121,18 @@ krb5_data_alloc(krb5_data *p, int len) return 0; } +/** + * Grow (or shrink) the content of krb5_data to a new size. + * + * @param p krb5_data to free. + * @param len new size. + * + * @return Returns 0 to indicate success. Otherwise an kerberos et + * error code is returned. + * + * @ingroup krb5 + */ + krb5_error_code KRB5_LIB_FUNCTION krb5_data_realloc(krb5_data *p, int len) { @@ -86,6 +145,19 @@ krb5_data_realloc(krb5_data *p, int len) return 0; } +/** + * Copy the data of len into the krb5_data. + * + * @param p krb5_data to copy into. + * @param data data to copy.. + * @param len new size. + * + * @return Returns 0 to indicate success. Otherwise an kerberos et + * error code is returned. + * + * @ingroup krb5 + */ + krb5_error_code KRB5_LIB_FUNCTION krb5_data_copy(krb5_data *p, const void *data, size_t len) { @@ -99,6 +171,19 @@ krb5_data_copy(krb5_data *p, const void *data, size_t len) return 0; } +/** + * Copy the data into a newly allocated krb5_data. + * + * @param context Kerberos 5 context. + * @param indata the krb5_data data to copy + * @param outdata new krb5_date to copy too. Free with krb5_free_data(). + * + * @return Returns 0 to indicate success. Otherwise an kerberos et + * error code is returned. + * + * @ingroup krb5 + */ + krb5_error_code KRB5_LIB_FUNCTION krb5_copy_data(krb5_context context, const krb5_data *indata, @@ -119,6 +204,17 @@ krb5_copy_data(krb5_context context, return ret; } +/** + * Compare to data. + * + * @param data1 krb5_data to compare + * @param data2 krb5_data to compare + * + * @return return the same way as memcmp(), useful when sorting. + * + * @ingroup krb5 + */ + int KRB5_LIB_FUNCTION krb5_data_cmp(const krb5_data *data1, const krb5_data *data2) { |