|
Packit |
d7e8d0 |
/* parsetlv.h - TLV functions definitions
|
|
Packit |
d7e8d0 |
* Copyright (C) 2012 g10 Code GmbH
|
|
Packit |
d7e8d0 |
*
|
|
Packit |
d7e8d0 |
* This file is free software; you can redistribute it and/or modify
|
|
Packit |
d7e8d0 |
* it under the terms of the GNU Lesser General Public License as
|
|
Packit |
d7e8d0 |
* published by the Free Software Foundation; either version 2.1 of
|
|
Packit |
d7e8d0 |
* the License, or (at your option) any later version.
|
|
Packit |
d7e8d0 |
*
|
|
Packit |
d7e8d0 |
* This file is distributed in the hope that it will be useful,
|
|
Packit |
d7e8d0 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
d7e8d0 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
d7e8d0 |
* GNU Lesser General Public License for more details.
|
|
Packit |
d7e8d0 |
*
|
|
Packit |
d7e8d0 |
* You should have received a copy of the GNU Lesser General Public License
|
|
Packit |
d7e8d0 |
* along with this program; if not, see <https://www.gnu.org/licenses/>.
|
|
Packit |
d7e8d0 |
*/
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
#ifndef PARSETLV_H
|
|
Packit |
d7e8d0 |
#define PARSETLV_H
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* ASN.1 constants. */
|
|
Packit |
d7e8d0 |
#define ASN1_CLASS_UNIVERSAL 0
|
|
Packit |
d7e8d0 |
#define ASN1_CLASS_APPLICATION 1
|
|
Packit |
d7e8d0 |
#define ASN1_CLASS_CONTEXT 2
|
|
Packit |
d7e8d0 |
#define ASN1_CLASS_PRIVATE 3
|
|
Packit |
d7e8d0 |
#define ASN1_TAG_INTEGER 2
|
|
Packit |
d7e8d0 |
#define ASN1_TAG_OBJECT_ID 6
|
|
Packit |
d7e8d0 |
#define ASN1_TAG_SEQUENCE 16
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* Object used with parse_tlv. */
|
|
Packit |
d7e8d0 |
struct tlvinfo_s
|
|
Packit |
d7e8d0 |
{
|
|
Packit |
d7e8d0 |
int cls; /* The class of the tag. */
|
|
Packit |
d7e8d0 |
int tag; /* The tag. */
|
|
Packit |
d7e8d0 |
int is_cons; /* True if it is a constructed object. */
|
|
Packit |
d7e8d0 |
int is_ndef; /* True if the object has an indefinite length. */
|
|
Packit |
d7e8d0 |
size_t length; /* The length of the value. */
|
|
Packit |
d7e8d0 |
size_t nhdr; /* The number of octets in the header (tag,length). */
|
|
Packit |
d7e8d0 |
};
|
|
Packit |
d7e8d0 |
typedef struct tlvinfo_s tlvinfo_t;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/*-- parsetlv.c --*/
|
|
Packit |
d7e8d0 |
int _gpgme_parse_tlv (char const **buffer, size_t *size, tlvinfo_t *ti);
|
|
Packit |
d7e8d0 |
#define parse_tlv(a,b,c) _gpgme_parse_tlv ((a), (b), (c))
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
#endif /*PARSETLV_H*/
|