[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Communications Technical Reference, Volume 1

xdr_union Subroutine

Purpose

Translates between discriminated unions and their external representations.

Library

C Library (libc.a)

Syntax

#include <rpc/xdr.h>
xdr_union (xdrs, dscmp, unp, armchoices, defaultarm)
XDR *xdrs;
enum_t *dscmp;
char *unp;
struct xdr_discrim *armchoices;
xdrproc_t (*defaultarm);

Description

The xdr_union subroutine is a filter primitive that translates between discriminated C unions and their corresponding external representations. It first translates the discriminant of the union located at the address pointed to by the dscmp parameter. This discriminant is always an enum_t value. Next, this subroutine translates the union located at the address pointed to by the unp parameter.

The armchoices parameter is a pointer to an array of xdr_discrim structures. Each structure contains an ordered pair of parameters [value, proc]. If the union's discriminant is equal to the associated value, then the specified process is called to translate the union. The end of the xdr_discrim structure array is denoted by a routine having a null value. If the discriminant is not found in the choices array, then the defaultarm structure is called (if it is not null).

Parameters

xdrs Points to the eXternal Data Representation (XDR) stream handle.
dscmp Specifies the address of the union's discriminant. The discriminant is an enumeration (enum_t) value.
unp Specifies the address of the union.
armchoices Points to an array of xdr_discrim structures.
defaultarm A structure provided in case no discriminants are found. This parameter can have a null value.

Return Values

Upon successful completion, this subroutine returns a value of 1. If unsuccessful, it returns a value of 0.

Implementation Specifics

This subroutine is part of Base Operating System (BOS) Runtime.

Related Information

List of XDR Programming References.

eXternal Data Representation (XDR) Overview for Programming and Understanding XDR Library Filter Primitives in AIX Version 4.3 Communications Programming Concepts.


[ Previous | Next | Contents | Glossary | Home | Search ]