encode_alt_addr(3xds) — Subroutines
Name
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> int encode_alt_addr(
const D2_alt_addr ∗in,
D2_str ∗∗out);
Parameters
in
A pointer to an alternate address attribute in a structured format.
Description
The encode_alt_addr() 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 encode_alt_addr().
encode_alt_addr() will allocate memory for the encoded string. (∗out) contains the address of the memory area that should later be freed by the application.
Return Values
∗∗outA pointer to the structure D2_str which stores the alternate address attribute in an internal GDS format.
(∗out)->d2_size will contain the length of the encoded octet string.
(∗out)->d2_value will be a pointer to the beginning of the encoded octet string. This string is not zero-terminated.
int
0If successful.
−1If unsuccessful (malloc() failure).
Related Information
Functions: decode_alt_addr(3xds).