Исходные коды спецификаций для LSB Core 3.1

/*
 * Copyright (c) 2005-2006 Institute for System Programming
 * Russian Academy of Sciences
 * All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
 * Portions of this text are reprinted and reproduced in electronic form
 * from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology
 * -- Portable Operating System Interface (POSIX), The Open Group Base
 * Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
 * Electrical and Electronics Engineers, Inc and The Open Group. In the
 * event of any discrepancy between this version and the original IEEE and
 * The Open Group Standard, the original IEEE and The Open Group Standard
 * is the referee document. The original Standard can be obtained online at
 * http://www.opengroup.org/unix/online.html.
 */

#include "socket/rpc/xdr_model.seh"
#include "common/common_media.seh"
#include "common/common_scenario.seh"

#pragma SEC subsystem rpc "socket.rpc"



/*
   The group of functions 'socket.rpc.xdr' consists of:
       xdr_accepted_reply [2]
       xdr_array [2]
       xdr_bool [2]
       xdr_bytes [2]
       xdr_callhdr [2]
       xdr_callmsg [2]
       xdr_char [2]
       xdr_double [2]
       xdr_enum [2]
       xdr_float [2]
       xdr_free [2]
       xdr_int [2]
       xdr_long [2]
       xdr_opaque [2]
       xdr_opaque_auth [2]
       xdr_pointer [2]
       xdr_reference [2]
       xdr_rejected_reply [2]
       xdr_replymsg [2]
       xdr_short [2]
       xdr_string [2]
       xdr_u_char [2]
       xdr_u_int [3]
       xdr_u_long [2]
       xdr_u_short [2]
       xdr_union [2]
       xdr_vector [2]
       xdr_void [2]
       xdr_wrapstring [2]
       xdrmem_create [2]
       xdrrec_create [2]
       xdrrec_eof [2]
 */

/********************************************************************/
/**                      Interface Functions                       **/
/********************************************************************/

/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    <none>

System V Interface Definition,
Fourth Edition

    bool_t
    xdr_accepted_reply(XDR *xdrs, const struct accepted_reply *ar);

*/

specification
BoolT xdr_accepted_reply_spec(CallContext context, XdrTPtr xdrs, AcceptedReplyTPtr ar)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
       /*
         * Used for encoding RPC reply messages.
         */
        REQ("xdr_accepted_reply.01", "", TODO_REQ());

        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    extern bool_t xdr_array(XDR *, caddr_t *, u_int *, u_int, u_int,
                            xdrproc_t);

System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdr_array(XDR *xdrs, caddr_t *arrp, u_int *sizep,
    const u_int maxsize, const u_int elsize, const xdrproc_t elproc);

*/

specification
BoolT xdr_array_spec(CallContext context, XdrTPtr xdrs, CaddrT* arrp, UIntT* sizep,
                     UIntT maxsize, UIntT elsize, XdrProcTPtr elproc)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
       /*
         * A filter primitive that translates between variable-length arrays and their
         * corresponding external representations.
         */
        REQ("xdr_array.01", "", TODO_REQ());

        /*
         * this element count cannot exceed maxsize.
         */
        REQ("xdr_array.02", "", TODO_REQ());

        /*
         * This routine returns one if it succeeds, zero otherwise.
         */
        REQ("xdr_array.03", "", TODO_REQ());
        
        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    extern bool_t xdr_bool(XDR *, bool_t *);

System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdr_bool(XDR *xdrs, bool_t *bp);

*/

specification
BoolT xdr_bool_spec(CallContext context, XdrTPtr xdrs, BoolT* bp)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        /*
         * A filter primitive that translates between booleans (C integers) and their
         * external representations.
         */
        REQ("xdr_bool.01", "", TODO_REQ());

        /*
         * When encoding data, this filter produces values of either one or zero.
         */
        REQ("xdr_bool.02", "", TODO_REQ());

        /*
         * This routine returns one if it succeeds, zero otherwise.
         */
        REQ("xdr_bool.03", "", TODO_REQ());
        
        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    extern bool_t xdr_bytes(XDR *, char **, u_int *, u_int);

System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdr_bytes(XDR *xdrs, char **sp, u_int *sizep,
    const u_int maxsize);

*/

specification
BoolT xdr_bytes_spec(CallContext context, XdrTPtr xdrs, CharTPtr* sp, UIntT* sizep, UIntT maxsize)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        /*
         * A filter primitive that translates between counted byte strings and their
         * external representations.
         */
        REQ("xdr_bytes.01", "", TODO_REQ());

        /*
         * strings cannot be longer than maxsize.
         */
        REQ("xdr_bytes.02", "", TODO_REQ());

        /*
         * This routine returns one if it succeeds, zero otherwise.
         */
        REQ("xdr_bytes.03", "", TODO_REQ());
        
        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    extern bool_t xdr_callhdr(XDR *, struct rpc_msg *);

System V Interface Definition,
Fourth Edition, June 15, 1995

    void
    xdr_callhdr(XDR *xdrs, const struct rpc_msg *chdr);

*/

specification
BoolT xdr_callhdr_spec(CallContext context, XdrTPtr xdrs, RpcMsgTPtr chdr)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        /*
         * Used for describing RPC call header messages.
         */
        REQ("xdr_callhdr.01", "", TODO_REQ());
        
        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    <none>

System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdr_callmsg(XDR *xdrs, const struct rpc_msg *cmsg);

*/

specification
BoolT xdr_callmsg_spec(CallContext context, XdrTPtr xdrs, RpcMsgTPtr cmsg)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        /*
         * Used for describing RPC call messages.
         */
        REQ("xdr_callmsg.01", "", TODO_REQ());
        
        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    extern bool_t xdr_char(XDR *, char *);

System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdr_char(XDR *xdrs, char *cp);

*/

specification
BoolT xdr_char_spec(CallContext context, XdrTPtr xdrs, CharT* cp)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        /*
         * A filter primitive that translates between C characters and their external
         * representations.
         */
        REQ("xdr_char.01", "", TODO_REQ());

        /*
         * This routine returns one if it succeeds, zero otherwise.
         */
        REQ("xdr_char.02", "", TODO_REQ());
        
        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    extern bool_t xdr_double(XDR *, double *);

System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdr_double(XDR *xdrs, double *dp);

*/

specification
BoolT xdr_double_spec(CallContext context, XdrTPtr xdrs, Unifloat* dp)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        /*
         * A filter primitive that translates between C double precision numbers and their
         * external representations.
         */
        REQ("xdr_double.01", "", TODO_REQ());

        /*
         * This routine returns one if it succeeds, zero otherwise.
         */
        REQ("xdr_double.02", "", TODO_REQ());
        
        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    extern bool_t xdr_enum(XDR *, enum_t *);

System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdr_enum(XDR *xdrs, enum_t *ep);

*/

specification
BoolT xdr_enum_spec(CallContext context, XdrTPtr xdrs, EnumT* ep)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        /*
         * A filter primitive that translates between C enums (actually integers) and
         * their external representations.
         */
        REQ("xdr_enum.01", "", TODO_REQ());

        /*
         * This routine returns one if it succeeds, zero otherwise.
         */
        REQ("xdr_enum.02", "", TODO_REQ());
        
        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    extern bool_t xdr_float(XDR *, float *);

System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdr_float(XDR *xdrs, float *fp);

*/

specification
BoolT xdr_float_spec(CallContext context, XdrTPtr xdrs, Unifloat* fp)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        /*
         * A filter primitive that translates between C floats and their external
         * representations.
         */
        REQ("xdr_float.01", "", TODO_REQ());

        /*
         * This routine returns one if it succeeds, zero otherwise.
         */
        REQ("xdr_float.02", "", TODO_REQ());
        
        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    extern void xdr_free(xdrproc_t, char *);

System V Interface Definition,
Fourth Edition, June 15, 1995

    void
    xdr_free(xdrproc_t proc, char *objp);

*/

specification
void xdr_free_spec(CallContext context, XdrProcTPtr proc, CharTPtr* objp)
{
    pre
    {
        REQ("", "function addresses should be initialized by initSocketRpcXdrModel()", !isNULL_VoidTPtr(xdr_string_addr));

        REQ("", "xdr_free works correctly only for xdr_string and xdr_wrapstring functions",
            T(equals_VoidTPtr(proc, xdr_string_addr))
            ||
            T(equals_VoidTPtr(proc, xdr_wrapstring_addr))
           );

        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        /*
         * Generic freeing routine.
         */
        REQ("xdr_free.01", "", TODO_REQ());

        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    extern bool_t xdr_int(XDR *, int *);

System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdr_int(XDR *xdrs, int *ip);

*/

specification
BoolT xdr_int_spec(CallContext context, XdrTPtr xdrs, IntT* ip)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        /*
         * A filter primitive that translates between C integers and their external
         * representations.
         */
        REQ("xdr_int.01", "", TODO_REQ());

        /*
         * This routine returns one if it succeeds, zero otherwise.
         */
        REQ("xdr_int.02", "", TODO_REQ());
        
        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    extern bool_t xdr_long(XDR *, long int *);

System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdr_long(XDR *xdrs, long *lp);

*/

specification
BoolT xdr_long_spec(CallContext context, XdrTPtr xdrs, LongT* lp)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        /*
         * A filter primitive that translates between C long integers and their external
         * representations.
         */
        REQ("xdr_long.01", "", TODO_REQ());

        /*
         * This routine returns one if it succeeds, zero otherwise.
         */
        REQ("xdr_long.02", "", TODO_REQ());

        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    extern bool_t xdr_opaque(XDR *, caddr_t, u_int);

System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdr_opaque(XDR *xdrs, caddr_t cp, const u_int cnt);

*/

specification
BoolT xdr_opaque_spec(CallContext context, XdrTPtr xdrs, CaddrT cp, UIntT cnt)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        /*
         * Used for describing RPC authentication information messages.
         */
        REQ("xdr_opaque_auth.01", "", TODO_REQ());
        
        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    extern bool_t xdr_opaque_auth(XDR *, struct opaque_auth *);

System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdr_opaque_auth(XDR *xdrs, const struct opaque_auth *ap);

*/

specification
BoolT xdr_opaque_auth_spec(CallContext context, XdrTPtr xdrs, OpaqueAuthTPtr ap)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        /*
         * Used for describing RPC authentication information messages.
         */
        REQ("xdr_opaque_auth.01", "", TODO_REQ());
        
        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    extern bool_t xdr_pointer(XDR *, char **, u_int, xdrproc_t);

System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdr_pointer(XDR *xdrs, char **objpp, u_int objsize,
    const xdrproc_t xdrobj);

*/

specification
BoolT xdr_pointer_spec(CallContext context, XdrTPtr xdrs, CharTPtr* objpp,
                       UIntT objsize, XdrProcTPtr xdrobj)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        /*
         * Like xdr_reference() except that it serializes NULL pointers, whereas
         * xdr_reference() does not.
         */
        REQ("xdr_pointer.01", "", TODO_REQ());

        /*
         * Thus, xdr_pointer() can represent recursive data structures, such as binary
         * trees or linked lists.
         */
        REQ("xdr_pointer.02", "", TODO_REQ());
        
        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    extern bool_t xdr_reference(XDR *, caddr_t *, u_int, xdrproc_t);

System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdr_reference(XDR *xdrs, caddr_t *pp, u_int size,
    const xdrproc_t proc);

*/

specification
BoolT xdr_reference_spec(CallContext context, XdrTPtr xdrs, CharTPtr* pp,
                         UIntT size, XdrProcTPtr proc)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        /*
         * A primitive that provides pointer chasing within structures.
         */
        REQ("xdr_reference.01", "", TODO_REQ());

        /*
         * This routine returns one if it succeeds, zero otherwise.
         */
        REQ("xdr_reference.02", "", TODO_REQ());

        /*
         * this routine does not understand NULL pointers.
         */
        REQ("xdr_reference.03", "", TODO_REQ());
        
        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    <none>

System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdr_rejected_reply(XDR *xdrs, const struct rejected_reply *rr);

*/

specification
BoolT xdr_rejected_reply_spec(CallContext context, XdrTPtr xdrs, RejectedReplyTPtr rr)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        /*
         * Used for describing RPC reply messages.
         */
        REQ("xdr_rejected_reply.01", "", TODO_REQ());
        
        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    <none>

System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdr_replymsg(XDR *xdrs, const struct rpc_msg *rmsg);

*/

specification
BoolT xdr_replymsg_spec(CallContext context, XdrTPtr xdrs, RpcMsgTPtr rmsg)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        /*
         * Used for describing RPC reply messages.
         */
        REQ("xdr_replymsg.01", "", TODO_REQ());
        
        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    extern bool_t xdr_short(XDR *, short *);

System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdr_short(XDR *xdrs, short *sp);

*/

specification
BoolT xdr_short_spec(CallContext context, XdrTPtr xdrs, ShortT* sp)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        /*
         * A filter primitive that translates between C short integers and their external
         * representations.
         */
        REQ("xdr_short.01", "", TODO_REQ());

        /*
         * This routine returns one if it succeeds, zero otherwise.
         */
        REQ("xdr_short.02", "", TODO_REQ());
        
        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    extern bool_t xdr_string(XDR *, char **, u_int);

System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdr_string(XDR *xdrs, char **sp, const u_int maxsize);

*/

specification
BoolT xdr_string_spec(CallContext context, XdrTPtr xdrs, CharTPtr* sp, UIntT maxsize)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        /*
         * A filter primitive that translates between C strings and their corresponding
         * external representations.
         */
        REQ("xdr_string.01", "", TODO_REQ());

        /*
         * Strings cannot be longer than maxsize.
         */
        REQ("xdr_string.02", "", TODO_REQ());

        /*
         * This routine returns one if it succeeds, zero otherwise.
         */
        REQ("xdr_string.03", "", TODO_REQ());
        
        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    extern bool_t xdr_u_char(XDR *, u_char *);

System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdr_u_char(XDR *xdrs, char *ucp);

*/

specification
BoolT xdr_u_char_spec(CallContext context, XdrTPtr xdrs, UCharT* ucp)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        /*
         * A filter primitive that translates between unsigned C characters and their
         * external representations.
         */
        REQ("xdr_u_char.01", "", TODO_REQ());

        /*
         * This routine returns one if it succeeds, zero otherwise.
         */
        REQ("xdr_u_char.02", "", TODO_REQ());
        
        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

NAME

    xdr_u_int -- library routines for external data representation

SYNOPSIS

    int xdr_u_int(XDR * xdrs, unsigned int * up);

DESCRIPTION

    xdr_u_int() is a filter primitive that translates between C unsigned integers
    and their external representations.

RETURN VALUE

    On success, 1 is returned. On error, 0 is returned.

*/
/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    extern bool_t xdr_u_int(XDR *, u_int *);

System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdr_u_int(XDR *xdrs, unsigned int *up);

*/

specification
BoolT xdr_u_int_spec(CallContext context, XdrTPtr xdrs, UIntT* up)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        /*
         * xdr_u_int() is a filter primitive that translates between C unsigned integers
         * and their external representations.
         */
        REQ("xdr_u_int.01", "", TODO_REQ());

        /*
         * On success, 1 is returned.
         */
        REQ("xdr_u_int.02", "", TODO_REQ());

        /*
         * On error, 0 is returned.
         */
        REQ("xdr_u_int.03", "", TODO_REQ());

        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    extern bool_t xdr_u_long(XDR *, u_long *);

System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdr_u_long(XDR *xdrs, unsigned long *ulp);

*/

specification
BoolT xdr_u_long_spec(CallContext context, XdrTPtr xdrs, ULongT* ulp)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        /*
         * A filter primitive that translates between C unsigned long integers and their
         * external representations.
         */
        REQ("xdr_u_long.01", "", TODO_REQ());

        /*
         * This routine returns one if it succeeds, zero otherwise.
         */
        REQ("xdr_u_long.02", "", TODO_REQ());

        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    extern bool_t xdr_u_short(XDR *, u_short *);

System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdr_u_short(XDR *xdrs, unsigned short *usp);

*/

specification
BoolT xdr_u_short_spec(CallContext context, XdrTPtr xdrs, UShortT* usp)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        /*
         * A filter primitive that translates between C unsigned short integers and their
         * external representations.
         */
        REQ("xdr_u_short.01", "", TODO_REQ());

        /*
         * This routine returns one if it succeeds, zero otherwise.
         */
        REQ("xdr_u_short.02", "", TODO_REQ());

        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    extern bool_t xdr_union(XDR *, enum_t *, char *,
                            const struct xdr_discrim *, xdrproc_t);

System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdr_union(XDR *xdrs, enum_t *dscmp, char *unp,
    const struct xdr_discrim *choices,
    const bool_t (*defaultarm)(const XDR *, const char *, const int));

*/

specification
BoolT xdr_union_spec(CallContext context, XdrTPtr xdrs, EnumT* dscmp, CharTPtr unp,
                     XdrDiscrimTPtr choices, XdrProcTPtr defaultparam)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        /*
         * A filter primitive that translates between a discriminated C union and its
         * corresponding external representation.
         */
        REQ("xdr_union.01", "", TODO_REQ());

        /*
         * It first translates the discriminant of the union located at dscmp.
         */
        REQ("xdr_union.02", "", TODO_REQ());

        /*
         * This discriminant is always an enum_t.
         */
        REQ("xdr_union.03", "", TODO_REQ());

        /*
         * Next the union located at unp is translated.
         */
        REQ("xdr_union.04", "", TODO_REQ());

        /*
         * If the union's discriminant is equal to the associated value, then the proc is
         * called to translate the union.
         */
        REQ("xdr_union.05", "", TODO_REQ());

        /*
         * If the discriminant is not found in the choices array, then the defaultarm
         * procedure is called (if it is not NULL).
         */
        REQ("xdr_union.06", "", TODO_REQ());

        /*
         * Returns one if it succeeds, zero otherwise.
         */
        REQ("xdr_union.07", "", TODO_REQ());
        
        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    extern bool_t xdr_vector(XDR *, char *, u_int, u_int, xdrproc_t);

System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdr_vector(XDR *xdrs, char *arrp, const u_int size,
    const u_int elsize, const xdrproc_t elproc);

*/

specification
BoolT xdr_vector_spec(CallContext context, XdrTPtr xdrs, CharTPtr arrp,
                      UIntT size, UIntT elsize, XdrProcTPtr elproc)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        /*
         * A filter primitive that translates between fixed-length arrays and their
         * corresponding external representations.
         */
        REQ("xdr_vector.01", "", TODO_REQ());

        /*
         * This routine returns one if it succeeds, zero otherwise.
         */
        REQ("xdr_vector.02", "", TODO_REQ());

        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    extern bool_t xdr_void(void);

System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdr_void(void);

*/

specification
BoolT xdr_void_spec(CallContext context)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        /*
         * This routine always returns one.
         */
        REQ("xdr_void.01", 
            "This routine always returns one",
            xdr_void_spec == 1);

        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    extern bool_t xdr_wrapstring(XDR *, char **);

System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdr_wrapstring(XDR *xdrs, char **sp);

*/

specification
BoolT xdr_wrapstring_spec(CallContext context, XdrTPtr xdrs, CharTPtr* sp)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
       /*
         * A primitive that calls xdr_string(xdrs, sp,MAXUN.UNSIGNED ); where MAXUN.
         * UNSIGNED is the maximum value of an unsigned integer.
         */
        REQ("xdr_wrapstring.01", "", TODO_REQ());

        /*
         * Returns one if it succeeds, zero otherwise.
         */
        REQ("xdr_wrapstring.02", "", TODO_REQ());
        
        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    extern void xdrmem_create(XDR *, caddr_t, u_int, enum xdr_op);

System V Interface Definition,
Fourth Edition, June 15, 1995

    void
    xdrmem_create(XDR *xdrs, const caddr_t addr,
    const u_int size, const enum xdr_op op);

*/

specification
void xdrmem_create_spec(CallContext context, XdrTPtr xdrs, CaddrT addr, UIntT size, XdrOp op)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        /*
         * This routine initializes the XDR stream object pointed to by xdrs.
         */
        REQ("xdrmem_create.01", "", TODO_REQ());

        /*
         * The stream's data is written to, or read from, a chunk of memory at location
         * addr whose length is no more than size bytes long.
         */
        REQ("xdrmem_create.02", "", TODO_REQ());

        /*
         * The op determines the direction of the XDR stream (either XDR_ENCODE,
         * XDR_DECODE, or XDR_FREE).
         */
        REQ("xdrmem_create.03", "", TODO_REQ());
        
        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    extern void xdrrec_create(XDR *, u_int, u_int, caddr_t,
                              int (*)(char *, char *, int)
                              , int (*)(char *, char *, int)
        );

System V Interface Definition,
Fourth Edition, June 15, 1995

    void
    xdrrec_create(XDR *xdrs, const u_int sendsz,
    const u_int recvsz, const caddr_t handle,
    const int (*readit)(const void *, char *, const int),
    const int (*writeit)(const void *, const char *, const int));

*/

specification
void xdrrec_create_spec(CallContext context, XdrTPtr xdrs, UIntT sendsz, UIntT recvsz,
                        CaddrT handle, ReadProcTPtr readit, WriteProcTPtr writeit, XdrOp op)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
       /*
         * This routine initializes the XDR stream object pointed to by xdrs.
         */
        REQ("xdrrec_create.01", "", TODO_REQ());

        /*
         * The stream's data is written to a buffer of size sendsize;
         */
        REQ("xdrrec_create.02", "", TODO_REQ());

        /*
         * a value of zero indicates the system should use a suitable default.
         */
        REQ("xdrrec_create.03", "", TODO_REQ());

        /*
         * The stream's data is read from a buffer of size recvsize; it too can be set to
         * a suitable default by passing a zero value.
         */
        REQ("xdrrec_create.04", "", TODO_REQ());

        /*
         * When a stream's output buffer is full, writeit is called.
         */
        REQ("xdrrec_create.05", "", TODO_REQ());

        /*
         * Similarly, when a stream's input buffer is empty, readit is called.
         */
        REQ("xdrrec_create.06", "", TODO_REQ());

        /*
         * The behavior of these two routines is similar to the system calls read() and
         * write(), except that handle is passed to the former routines as the first
         * parameter.
         */
        REQ("xdrrec_create.07", "", TODO_REQ());

        /*
         * the XDR stream's op field must be set by the caller.
         */
        REQ("xdrrec_create.08", "", TODO_REQ());
        
        return true;
    }
}


/*
Linux Standard Base Core Specification 3.1
Copyright (c) 2004, 2005 Free Standards Group

    extern bool_t xdrrec_eof(XDR *);

System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdrrec_eof(XDR *xdrs);

*/

specification
BoolT xdrrec_eof_spec(CallContext context, XdrTPtr xdrs)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        /*
         * This routine can be invoked only on streams created by xdrrec_create().
         */
        REQ("xdrrec_eof.01", "", TODO_REQ());

        /*
         * After consuming the rest of the current record in the stream, this routine
         * returns one if the stream has no more input, zero otherwise.
         */
        REQ("xdrrec_eof.02", "", TODO_REQ());

        return true;
    }
}


/*
System V Interface Definition,
Fourth Edition, June 15, 1995

    void
    xdr_destroy(XDR *xdrs);

Note: This function is not present in LSB 3.1, but it was added in the test suite
      to avoid memory leaks after creating XDR structures.
*/

specification
void xdr_destroy_spec(CallContext context, XdrTPtr xdrs)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        return true;
    }
}


/*
System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdrrec_endofrecord(XDR *xdrs; int sendnow);

Note: This function is not present in LSB 3.1, but it was added in the test suite
      to have possibility of testing xdrrec_* functions.
*/

specification
BoolT xdrrec_endofrecord_spec(CallContext context, XdrTPtr xdrs, IntT sendnow)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        return true;
    }
}


/*
System V Interface Definition,
Fourth Edition, June 15, 1995

    bool_t
    xdrrec_skiprecord(XDR *xdrs);

Note: This function is not present in LSB 3.1, but it was added in the test suite
      to have possibility of testing xdrrec_* functions.
*/

specification
BoolT xdrrec_skiprecord_spec(CallContext context, XdrTPtr xdrs)
{
    pre
    {
        return true;
    }
    coverage C
    {
        return {TheOnlyBranch, "The only branch"};
    }
    post
    {
        return true;
    }
}

/********************************************************************/
/**                       Xdr Types                                **/
/********************************************************************/

XdrProcTPtr xdr_accepted_reply_addr;
XdrProcTPtr xdr_array_addr;
XdrProcTPtr xdr_bool_addr;
XdrProcTPtr xdr_bytes_addr;
XdrProcTPtr xdr_callhdr_addr;
XdrProcTPtr xdr_callmsg_addr;
XdrProcTPtr xdr_char_addr;
XdrProcTPtr xdr_double_addr;
XdrProcTPtr xdr_enum_addr;
XdrProcTPtr xdr_float_addr;
XdrProcTPtr xdr_int_addr;
XdrProcTPtr xdr_long_addr;
XdrProcTPtr xdr_opaque_addr;
XdrProcTPtr xdr_opaque_auth_addr;
XdrProcTPtr xdr_pointer_addr;
XdrProcTPtr xdr_reference_addr;
XdrProcTPtr xdr_rejected_reply_addr;
XdrProcTPtr xdr_replymsg_addr;
XdrProcTPtr xdr_short_addr;
XdrProcTPtr xdr_string_addr;
XdrProcTPtr xdr_u_char_addr;
XdrProcTPtr xdr_u_int_addr;
XdrProcTPtr xdr_u_long_addr;
XdrProcTPtr xdr_u_short_addr;
XdrProcTPtr xdr_union_addr;
XdrProcTPtr xdr_vector_addr;
XdrProcTPtr xdr_void_addr;
XdrProcTPtr xdr_wrapstring_addr;
VoidTPtr readfp_addr;
VoidTPtr writefp_addr;

/********************************************************************/
/**                       Helper Functions                         **/
/********************************************************************/

static VoidTPtr getFunctionAddress(CallContext context, const char* func_name)
{
    VoidTPtr res = NULL_VoidTPtr;
    TSCommand command = create_TSCommand();

    format_TSCommand(&command, "func_addr_socket_rpc_xdr:$(str)",
                                create_CString((CharT*)func_name)
                    );
    executeCommandInContext(context, &command);
    if (!isBadVerdict())
    {
        res = readPointer_TSStream(context, &command.response);
    }

    destroy_TSCommand(&command);

    return res;
}

/*
 * This function MUST be called before using socket.rpc.xdr subsystem!
 * This initialization needs agent running, so call it from the scenario function.
 */
void initSocketRpcXdrModel(void)
{
    CallContext context = getContext();

    xdr_accepted_reply_addr = getFunctionAddress(context, "xdr_accepted_reply");
    xdr_array_addr = getFunctionAddress(context, "xdr_array");
    xdr_bool_addr = getFunctionAddress(context, "xdr_bool");
    xdr_bytes_addr = getFunctionAddress(context, "xdr_bytes");
    xdr_callhdr_addr = getFunctionAddress(context, "xdr_callhdr");
    xdr_callmsg_addr = getFunctionAddress(context, "xdr_callmsg");
    xdr_char_addr = getFunctionAddress(context, "xdr_char");
    xdr_double_addr = getFunctionAddress(context, "xdr_double");
    xdr_enum_addr = getFunctionAddress(context, "xdr_enum");
    xdr_float_addr = getFunctionAddress(context, "xdr_float");
    xdr_int_addr = getFunctionAddress(context, "xdr_int");
    xdr_long_addr = getFunctionAddress(context, "xdr_long");
    xdr_opaque_addr = getFunctionAddress(context, "xdr_opaque");
    xdr_opaque_auth_addr = getFunctionAddress(context, "xdr_opaque_auth");
    xdr_pointer_addr = getFunctionAddress(context, "xdr_pointer");
    xdr_reference_addr = getFunctionAddress(context, "xdr_reference");
    xdr_rejected_reply_addr = getFunctionAddress(context, "xdr_rejected_reply");
    xdr_replymsg_addr = getFunctionAddress(context, "xdr_replymsg");
    xdr_short_addr = getFunctionAddress(context, "xdr_short");
    xdr_string_addr = getFunctionAddress(context, "xdr_string");
    xdr_u_char_addr = getFunctionAddress(context, "xdr_u_char");
    xdr_u_int_addr = getFunctionAddress(context, "xdr_u_int");
    xdr_u_long_addr = getFunctionAddress(context, "xdr_u_long");
    xdr_u_short_addr = getFunctionAddress(context, "xdr_u_short");
    xdr_union_addr = getFunctionAddress(context, "xdr_union");
    xdr_vector_addr = getFunctionAddress(context, "xdr_vector");
    xdr_void_addr = getFunctionAddress(context, "xdr_void");
    xdr_wrapstring_addr = getFunctionAddress(context, "xdr_wrapstring");
    readfp_addr = getFunctionAddress(context, "readfp");
    writefp_addr = getFunctionAddress(context, "writefp");
}