serialize.c revision 159d09a20817016f09b3ea28d1bdada4a336bb91
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
*
* Copyright 1995 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of M.I.T. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
* fashion that it might be confused with the original M.I.T. software.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*
*/
/*
* Base routines to deal with serialization of Kerberos metadata.
*/
#include "k5-int.h"
/* Solaris Kerberos */
#include <k5-platform.h>
#include <k5-platform-store_64.h>
#include <k5-platform-load_64.h>
/*
* krb5_find_serializer() - See if a particular type is registered.
*/
{
int i;
for (i=0; i<kcontext->ser_ctx_count; i++) {
break;
}
}
return(res);
}
/*
* krb5_register_serializer() - Register a particular serializer.
*/
{
kret = 0;
/* See if it's already there, if so, we're good to go. */
/*
* Can't find our type. Create a new entry.
*/
/* Copy in old table */
if (kcontext->ser_ctx_count)
/* Copy in new entry */
sizeof(krb5_ser_entry));
}
else
}
else
return(kret);
}
/*
* krb5_size_opaque() - Determine the size necessary to serialize a given
* piece of opaque data.
*/
{
/* See if the type is supported, if so, do it */
return(kret);
}
/*
* krb5_externalize_opaque() - Externalize a piece of opaque data.
*/
krb5_externalize_opaque(krb5_context kcontext, krb5_magic odtype, krb5_pointer arg, krb5_octet **bufpp, size_t *sizep)
{
/* See if the type is supported, if so, do it */
return(kret);
}
/*
* Externalize a piece of arbitrary data.
*/
{
krb5_magic *mp;
bufsize = 0;
*mp,
arg,
&bp,
&bsize))) {
if (bsize != 0)
}
}
else
}
return(kret);
}
/*
* krb5_internalize_opaque() - Convert external representation into a data
* structure.
*/
krb5_internalize_opaque(krb5_context kcontext, krb5_magic odtype, krb5_pointer *argp, krb5_octet **bufpp, size_t *sizep)
{
/* See if the type is supported, if so, do it */
return(kret);
}
/*
* krb5_ser_pack_int32() - Pack a 4-byte integer if space is available.
* Update buffer pointer and remaining space.
*/
{
if (*remainp >= sizeof(krb5_int32)) {
*bufp += sizeof(krb5_int32);
*remainp -= sizeof(krb5_int32);
return(0);
}
else
return(ENOMEM);
}
/*
* krb5_ser_pack_int64() - Pack an 8-byte integer if space is available.
* Update buffer pointer and remaining space.
*/
{
if (*remainp >= sizeof(krb5_int64)) {
*bufp += sizeof(krb5_int64);
*remainp -= sizeof(krb5_int64);
return(0);
}
else
return(ENOMEM);
}
/*
* krb5_ser_pack_bytes() - Pack a string of bytes.
*/
{
return(0);
}
else
return(ENOMEM);
}
/*
* krb5_ser_unpack_int32() - Unpack a 4-byte integer if it's there.
*/
{
if (*remainp >= sizeof(krb5_int32)) {
*bufp += sizeof(krb5_int32);
*remainp -= sizeof(krb5_int32);
return(0);
}
else
return(ENOMEM);
}
/*
* krb5_ser_unpack_int64() - Unpack an 8-byte integer if it's there.
*/
{
if (*remainp >= sizeof(krb5_int64)) {
*bufp += sizeof(krb5_int64);
*remainp -= sizeof(krb5_int64);
return(0);
}
else
return(ENOMEM);
}
/*
* krb5_ser_unpack_bytes() - Unpack a byte string if it's there.
*/
{
return(0);
}
else
return(ENOMEM);
}