📄 componentlib.h
字号:
/* Copyright 2004 IBM Corporation * All rights reserved. * Redisribution and use in source and binary forms, with or without * modification, are permitted only as authorizd by the OpenLADP * Public License. *//* ACKNOWLEDGEMENTS * This work originally developed by Sang Seok Lim * 2004/06/18 03:20:00 slim@OpenLDAP.org */#ifndef _H_COMPONENT_MODULE#define _H_COMPONENT_MODULE#include "portable.h"#include <ac/string.h>#include <ac/socket.h>#include <ldap_pvt.h>#include "lutil.h"#include <ldap.h>#include <slap.h>#include <component.h>#include <asn-incl.h>#include "asn.h"#include <asn-gser.h>#include <string.h>#define MAX_IDENTIFIER_LEN 32#define COMPONENTNOT_NULL(ptr) ((ptr) != NULL)typedef struct slap_component_type { /* * Don't change the order of following fields * They are identical the first 9 fields of * AttributeType */ LDAPAttributeType ct_atype; struct berval ct_cname; struct slap_attribute_type *ct_sup; struct slap_attribute_type **ct_subtypes; MatchingRule *ct_equality; MatchingRule *ct_approx; MatchingRule *ct_ordering; MatchingRule *ct_substr; Syntax *ct_syntax;} ComponentType;/* * BIT STRING */typedef struct ComponentBits { void* syntax; ComponentDesc* comp_desc; struct berval identifier; char id_buf[MAX_IDENTIFIER_LEN]; AsnBits value;} ComponentBits;#define GASNBITS_PRESENT(abits) ((abits)->value.bits != NULL)#define COMPONENTBITS_PRESENT(abits) ((abits)->value.bits != NULL)int GEncComponentBits (GenBuf *b, ComponentBits* bits);int GDecComponentBits (void* mem_op, GenBuf *b, void *result, AsnLen *bytesDecoded, int mode);int BDecComponentBits (void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *result, AsnLen *bytesDecoded, int mode);int MatchingComponentBits (char* oid, ComponentSyntaxInfo *bits1 , ComponentSyntaxInfo* bits2);#define ExtractingComponentBits( mem_op, cr,data ) NULL/* * BMP String */typedef struct ComponentBMPString { void* syntax; ComponentDesc* comp_desc; struct berval identifier; char id_buf[MAX_IDENTIFIER_LEN]; BMPString value;} ComponentBMPString;int GEncComponentBMPString (GenBuf *b, ComponentBMPString* bmp);int GDecComponentBMPString (void* mem_op, GenBuf *b, void *result, AsnLen *bytesDecoded, int mode);int BDecComponentBMPString (void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *result, AsnLen *bytesDecoded, int mode);#define MatchingComponentBMPString MatchingComponentOcts#define ExtractingComponentBMPString( mem_op, cr, data ) NULL#define FreeComponentBMPString FreeComponentOcts/* * BOOLEAN */typedef struct ComponentBool { void* syntax; ComponentDesc* comp_desc; struct berval identifier; char id_buf[MAX_IDENTIFIER_LEN]; AsnBool value;} ComponentBool;int GEncComponentBool (GenBuf *b, ComponentBool * bool );int GDecComponentBool ( void* mem_op, GenBuf *b, void *result, AsnLen *bytesDecoded, int mode);int BDecComponentBool ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *result, AsnLen *bytesDecoded, int mode);int MatchingComponentBool (char* oid, ComponentSyntaxInfo *a, ComponentSyntaxInfo *b);#define ExtractingComponentBool( mem_op, cr, data ) NULL#define FreeComponentBool(v) NULL/* * ENUMERTED */typedef struct ComponentEnum { void* syntax; ComponentDesc* comp_desc; struct berval identifier; char id_buf[MAX_IDENTIFIER_LEN]; AsnEnum value; struct berval value_identifier;/*Why this value is defined here?*/} ComponentEnum;int GEncComponentEnum (GenBuf *b, ComponentEnum* comp_enum);int GDecComponentEnum ( void* mem_op, GenBuf *a, void *result, AsnLen *bytesDecoded,int mode);int BDecComponentEnum ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *result, AsnLen *bytesDecoded, int mode);int MatchingComponentEnum (char *oid, ComponentSyntaxInfo *a, ComponentSyntaxInfo * b);#define ExtractingComponentEnum( mem_op, cr, data ) NULL#define FreeComponentEnum FreeComponentInt/* * IA5 String */typedef struct ComponentIA5String { void* syntax; ComponentDesc* comp_desc; struct berval identifier; char id_buf[MAX_IDENTIFIER_LEN]; IA5String value;} ComponentIA5String;#define GEncComponentIA5String GEncComponentUTF8String#define GDecComponentIA5String GDecComponentUTF8StringintBDecComponentIA5StringTag ( void* mem_op, GenBuf *b, void *v, AsnLen *bytesDecoded, int mode );int BDecComponentIA5String ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *result, AsnLen *bytesDecoded, int mode);#define MatchingComponentIA5String MatchingComponentOcts#define ExtractingComponentIA5String(mem_op, cr,data) NULL#define FreeComponentIA5String FreeComponentOcts/* * INTEGER */typedef struct ComponentInt { void* syntax; ComponentDesc* comp_desc; struct berval identifier; char id_buf[MAX_IDENTIFIER_LEN]; int value;} ComponentInt;#define GNOT_NULL(ptr) ((ptr) != NULL)int GEncComponentInt (GenBuf *b, ComponentInt *comp_int);int GDecComponentInt ( void* mem_op, GenBuf *b, void *result, AsnLen *bytesDecoded, int mode );int BDecComponentInt ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *result, AsnLen *bytesDecoded, int mode);int MatchingComponentInt (char* oid, ComponentSyntaxInfo *a, ComponentSyntaxInfo *b);#define ExtractingComponentInt(mem_op, cr,data) NULL#define FreeComponentInt(v) NULL/* * LIST Data Structure for C_LIST */typedef struct ComponentList { void* syntax; ComponentDesc* comp_desc; struct berval identifier; char id_buf[MAX_IDENTIFIER_LEN]; AsnList comp_list;} ComponentList;/* * NULL */typedef struct ComponentNull { void* syntax; ComponentDesc* comp_desc; struct berval identifier; char id_buf[MAX_IDENTIFIER_LEN]; AsnNull value;} ComponentNull;int GEncComponentNull (GenBuf *b, ComponentNull* comp_null);int GDecComponentNull ( void* mem_op, GenBuf *b, void *result, AsnLen *bytesDecoded, int mode);int BDecComponentNull ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *result, AsnLen *bytesDecoded, int mode);int BDecComponentNullTag ( void* mem_op, GenBuf *b, void *v, AsnLen *bytesDecoded, int mode );int MatchingComponentNull (char* oid, ComponentSyntaxInfo *a, ComponentSyntaxInfo *b);#define ExtractingComponentNull(mem_op, cr, data) NULL#define FreeComponentNull NULL/* * Numeric String */typedef struct ComponentNumericString { void* syntax; ComponentDesc* comp_desc; struct berval identifier; char id_buf[MAX_IDENTIFIER_LEN]; NumericString value;} ComponentNumericString;#define GEncComponentNumericString GEncComponentUTF8String#define GDecComponentNumericString GDecComponentUTF8Stringint BDecComponentNumericString ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *result, AsnLen *bytesDecoded, int mode);#define MatchingComponentNumericString MatchingComponentOcts#define ExtractingComponentNumericString(mem_op, cr,data) NULL#define FreeComponentNumericString FreeComponentOcts/* * OCTETS STRING */typedef struct ComponentOcts { void* syntax; ComponentDesc* comp_desc; struct berval identifier; char id_buf[MAX_IDENTIFIER_LEN]; AsnOcts value;} ComponentOcts;#define GASNOCTS_PRESENT(aocts) ((aocts)->value.octs != NULL)int GEncComponentOcts (GenBuf *b, ComponentOcts *octs);int GDecComponentOcts (void* mem_op, GenBuf *b, void *result, AsnLen *bytesDecoded, int mode);int BDecComponentOctsTag ( void* mem_op, GenBuf *b, void *v, AsnLen *bytesDecoded, int mode );int BDecComponentOcts (void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *result, AsnLen *bytesDecoded, int mode);int MatchingComponentOcts (char* oid, ComponentSyntaxInfo *a, ComponentSyntaxInfo *b);#define ExtractingComponentOcts(mem_op,cr,data) NULLvoid FreeComponentOcts( ComponentOcts* octs );/* * OID (Object Identifier) */typedef struct ComponentOid { void* syntax; ComponentDesc* comp_desc; struct berval identifier; char id_buf[MAX_IDENTIFIER_LEN]; AsnOid value;} ComponentOid;#define GASNOID_PRESENT(aoid) ASNOCTS_PRESENT(aoid)int GEncComponentOid (GenBuf *b, ComponentOid *oid);int GDecComponentOid (void* mem_op, GenBuf *b, void *result, AsnLen *bytesDecoded, int mode);int BDecComponentOid (void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *result, AsnLen *bytesDecoded, int mode);int MatchingComponentOid (char* oid, ComponentSyntaxInfo *a, ComponentSyntaxInfo *b);#define ExtractingComponentOid(mem_op, cr, data) NULL#define FreeComponentOid FreeComponentOcts/* * Printable String */typedef struct ComponentPrintableString{ void* syntax; ComponentDesc* comp_desc; struct berval identifier; char id_buf[MAX_IDENTIFIER_LEN]; PrintableString value;} ComponentPrintableString;#define GEncComponentPrintableString GEncComponentUTF8String#define GDecComponentPrintableString GDecComponentUTF8Stringint BDecComponentPrintableString (void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *result, AsnLen *bytesDecoded, int mode);int BDecComponentPrintableStringTag (void* mem_op, GenBuf *b, void *v, AsnLen *bytesDecoded, int mode );#define MatchingComponentPrintableString MatchingComponentOcts#define ExtractingComponentPrintableString(mem_op, cr, data) NULL#define FreeComponentPrintableString FreeComponentOcts/* * REAL */typedef struct ComponentReal{ void* syntax; ComponentDesc* comp_desc; struct berval identifier; char id_buf[MAX_IDENTIFIER_LEN]; AsnReal value;} ComponentReal;int GEncComponentReal (GenBuf *b, ComponentReal* comp_real);int GDecComponentReal (void* mem_op, GenBuf *b, void *result, AsnLen *bytesDecoded, int mode);int BDecComponentReal (void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *result, AsnLen *bytesDecoded, int mode);int MatchingComponentReal (char* oid, ComponentSyntaxInfo *a, ComponentSyntaxInfo *b);#define ExtractingComponentReal( mem_op, cr, data ) NULL#define FreeComponentReal(v) NULL/* * Relative OID */typedef struct ComponentRelativeOid { void* syntax; ComponentDesc* comp_desc; struct berval identifier; char id_buf[MAX_IDENTIFIER_LEN]; AsnRelativeOid value;} ComponentRelativeOid;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -