gds_encode_alt_addr(3xds) — Subroutines
Name
gds_encode_alt_addr - Converts an alternate address attribute structure into an internal GDS format
Synopsis
#include <xom.h>
#include <xds.h>
#include <dce/d2dir.h> d2_ret_val gds_encode_alt_addr(
const D2_alt_addr ∗in,
D2_str ∗∗out);
Parameters
Input
inA pointer to an alternate address attribute in a structured format.
Output
outA pointer to the structure D2_str that stores the alternate address attribute in an internal GDS format. The (∗out)->d2_size parameter will contain the length of the encoded octet string; the (∗out)->d2_value parameter will be a pointer to the beginning of the encoded octet string. This string is not zero-terminated.
Description
The gds_encode_alt_addr() function converts an alternate address stored in a D2_alt_addr structure into a linearized string that is stored in a structure of type D2_str. This function is provided for use by DME applications. It converts a structured alternate address attribute into a linear octet string for internal use by GDS.
The D2_alt_addr structure contains one field of type D2_str for storing the address, followed by a structured field for a set of object identifiers. The structure D2_str consists of the length of the address and a pointer to the start of the address (not zero-terminated). The second component of D2_alt_addr contains the number of object identifiers and the address of the first D2_obj_id structure. To store additional object identifiers, the address of the first D2_obj_id structure has to be increased by sizeof(D2_obj_id) bytes for each object identifier to be added.
The structure D2_obj_id consists of the length of the object identifier and a pointer to the beginning of the object identifier (not zero-terminated). Each object identifier is treated as an octet string; that means there is no BER conversion done by gds_encode_alt_addr().
The gds_encode_alt_addr() function will allocate memory for the encoded string. The (∗out) parameter contains the address of the memory area that should later be freed by the application.
Return Values
d2_ret_valD2_NOERROR (that is, 0), if successful.
D2_ERROR (that is, -1), if unsuccessful (malloc() failure).
Related Information
Functions: gds_decode_alt_addr(3xds).