ASN1_d2i_bio() -- SSLeay 0.9.0b -- January 1999

NAME

ASN1_d2i_fp, ASN1_i2d_fp, ASN1_d2i_bio,
ASN1_i2d_bio -- ASN1 io routines

SYNOPSIS

#include "asn1.h"

char *ASN1_d2i_fp(xnew,d2i,fp,x)
char *(*xnew)();
char *(*d2i)();
FILE *fp;
unsigned char **x;

char *ASN1_d2i_bio(xnew,d2i,bp,x)
char *(*xnew)();
char *(*d2i)();
BIO *bp;
unsigned char **x;

int ASN1_i2d_fp(i2d,fp,x)
int (*i2d)();
FILE *fp;
unsigned char *x;

int ASN1_i2d_bio(i2d,bp,x)
int (*i2d)();
BIO *bp;
unsigned char *x;

DESCRIPTION

ASN1_d2i_fp() reads from fp as much data as it can and then uses d2i to parse the bytes to load and return the parsed structure in x (if it was non-NULL) and to actually return the structure. x is a pointer to a pointer of the 'desired type'. new and d2i are the corresponding 'TYPE_new' and 'd2i_TYPE' functions for the type and fp is an open file pointer to read from.

ASN1_d2i_bio() is the same as ASN1_d2i_fp() except for the BIO argument. The BIO is the new IO type being used in SSLeay (see bio.doc). ASN1_d2i_fp() actually calls this function.

ASN1_i2d_fp() converts x to bytes via i2d and then writes the result to fp. ASN1_i2d_fp and ASN1_d2i_fp are not really symmetric since ASN1_i2d_fp will read all available data from the file pointer before parsing a single item while ASN1_i2d_fp can be used to write a sequence of data objects. To read a series of objects from a file, load the file into a buffer and call the relevant d2i functions.

ASN1_i2d_bio() is the same as ASN1_i2d_fp() except for the BIO argument. ASN1_i2d_fp() actually calls this function.