2N/A/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2N/A/*
2N/A * src/lib/krb5/asn.1/asn1_decode.h
2N/A *
2N/A * Copyright 1994 by the Massachusetts Institute of Technology.
2N/A * All Rights Reserved.
2N/A *
2N/A * Export of this software from the United States of America may
2N/A * require a specific license from the United States Government.
2N/A * It is the responsibility of any person or organization contemplating
2N/A * export to obtain such a license before exporting.
2N/A *
2N/A * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
2N/A * distribute this software and its documentation for any purpose and
2N/A * without fee is hereby granted, provided that the above copyright
2N/A * notice appear in all copies and that both that copyright notice and
2N/A * this permission notice appear in supporting documentation, and that
2N/A * the name of M.I.T. not be used in advertising or publicity pertaining
2N/A * to distribution of the software without specific, written prior
2N/A * permission. Furthermore if you modify this software you must label
2N/A * your software as modified software and not distribute it in such a
2N/A * fashion that it might be confused with the original M.I.T. software.
2N/A * M.I.T. makes no representations about the suitability of
2N/A * this software for any purpose. It is provided "as is" without express
2N/A * or implied warranty.
2N/A */
2N/A
2N/A#ifndef __ASN1_DECODE_H__
2N/A#define __ASN1_DECODE_H__
2N/A
2N/A#include "k5-int.h"
2N/A#include "krbasn1.h"
2N/A#include "asn1buf.h"
2N/A
2N/A/*
2N/A * Overview
2N/A *
2N/A * These procedures take an asn1buf whose current position points
2N/A * to the beginning of an ASN.1 primitive (<id><length><contents>).
2N/A * The primitive is removed from the buffer and decoded.
2N/A *
2N/A * Operations
2N/A *
2N/A * asn1_decode_integer
2N/A * asn1_decode_unsigned_integer
2N/A * asn1_decode_octetstring
2N/A * asn1_decode_charstring
2N/A * asn1_decode_generalstring
2N/A * asn1_decode_null
2N/A * asn1_decode_printablestring
2N/A * asn1_decode_ia5string
2N/A * asn1_decode_generaltime
2N/A */
2N/A
2N/A/* asn1_error_code asn1_decode_type(asn1buf *buf, ctype *val); */
2N/A/*
2N/A * requires *buf is allocated
2N/A * modifies *buf, *len
2N/A * effects Decodes the octet string in *buf into *val.
2N/A * Returns ENOMEM if memory is exhausted.
2N/A * Returns asn1 errors.
2N/A */
2N/A
2N/Aasn1_error_code asn1_decode_boolean(asn1buf *buf, unsigned int *val);
2N/Aasn1_error_code asn1_decode_integer(asn1buf *buf, long *val);
2N/Aasn1_error_code asn1_decode_unsigned_integer(asn1buf *buf, unsigned long *val);
2N/Aasn1_error_code asn1_decode_maybe_unsigned(asn1buf *buf, unsigned long *val);
2N/Aasn1_error_code asn1_decode_null(asn1buf *buf);
2N/A
2N/Aasn1_error_code asn1_decode_oid(asn1buf *buf, unsigned int *retlen,
2N/A asn1_octet **val);
2N/Aasn1_error_code asn1_decode_octetstring(asn1buf *buf, unsigned int *retlen,
2N/A asn1_octet **val);
2N/Aasn1_error_code asn1_decode_generalstring(asn1buf *buf, unsigned int *retlen,
2N/A char **val);
2N/Aasn1_error_code asn1_decode_charstring(asn1buf *buf, unsigned int *retlen,
2N/A char **val);
2N/A/*
2N/A * Note: A charstring is a special hack to account for the fact that
2N/A * krb5 structures store some OCTET STRING values in krb5_octet
2N/A * arrays and others in krb5_data structures
2N/A * (which use char arrays).
2N/A * From the ASN.1 point of view, the two string types are the same,
2N/A * only the receptacles differ.
2N/A */
2N/Aasn1_error_code asn1_decode_printablestring(asn1buf *buf, int *retlen,
2N/A char **val);
2N/Aasn1_error_code asn1_decode_ia5string(asn1buf *buf, int *retlen, char **val);
2N/A
2N/Aasn1_error_code asn1_decode_generaltime(asn1buf *buf, time_t *val);
2N/A
2N/A#endif