dbm/include/nsres.h
author chrisk%netscape.com
Tue, 20 Jun 2000 13:24:01 +0000
changeset 381 d748e5f9526290f415abb5815391bde83c5b45f8
parent 0 9949429068caa6bb8827a8ceeaa7c605d722f47f
child 2136 c707059d21d84c96c4cdaaa3ed35760425f49680
permissions -rw-r--r--
Fix bug in decoder: When encoding indefinitely & encountering an optional field at the end of a sequence, right after an IMPLICIT or POINTER template, the decoder was not propagating the optionalness and the end-of-contents condition correctly as it hits the end-of-contents octets instead of the optional field. This is because IMPLICIT and POINTER push TWO states to look for the next tag, not just one. (The first state is "afterImplicit" or "afterPointer", the second one starts with "beforeIdentifier" as usual). This finally makes decoding envelopedData messages in cmsutil work.

#ifndef NSRES_H
#define NSRES_H
#include "cdefs.h"
#include "mcom_db.h"

__BEGIN_DECLS

/* C version */
#define NSRESHANDLE void *

typedef void (*NSRESTHREADFUNC)(void *);

typedef struct NSRESTHREADINFO
{
	void *lock;
	NSRESTHREADFUNC fn_lock;
	NSRESTHREADFUNC fn_unlock;
} NSRESTHREADINFO;

#define MAXBUFNUM 10
#define MAXSTRINGLEN 300

#define NSRES_CREATE 1
#define NSRES_OPEN 2



NSRESHANDLE NSResCreateTable(const char *filename, NSRESTHREADINFO *threadinfo);
NSRESHANDLE NSResOpenTable(const char *filename, NSRESTHREADINFO *threadinfo);
void NSResCloseTable(NSRESHANDLE handle);

char *NSResLoadString(NSRESHANDLE handle, const char * library, int32 id, 
	unsigned int charsetid, char *retbuf);
int32 NSResGetSize(NSRESHANDLE handle, const char *library, int32 id);
int32 NSResLoadResource(NSRESHANDLE handle, const char *library, int32 id, char *retbuf);
int NSResAddString(NSRESHANDLE handle, const char *library, int32 id, const char *string, unsigned int charset);

__END_DECLS


#endif