Annotation of mstools/samples/rpc/data/dunion/dunionp.c, revision 1.1

1.1     ! root        1: /****************************************************************************
        !             2:                        Microsoft RPC Version 1.0
        !             3:                     Copyright Microsoft Corp. 1992
        !             4:                       Discriminated Union Example
        !             5: 
        !             6:     FILE:      unionp.c
        !             7:     PURPOSE:    Remote procedures that are linked with the server
        !             8:                side of RPC distributed application
        !             9:     FUNCTIONS: UnionParamProc() - union, discriminant are parameters
        !            10:                UnionStructProc() - union, discriminant in structure
        !            11:     COMMENTS:
        !            12: 
        !            13: ****************************************************************************/
        !            14: #include <stdlib.h>
        !            15: #include <stdio.h>
        !            16: #include <rpc.h>
        !            17: #include "dunion.h"
        !            18: 
        !            19: short UnionParamProc(
        !            20:    DISCRIM_UNION_PARAM_TYPE up,
        !            21:    short                   sDiscrim)
        !            22: {
        !            23:     printf("sDiscrim = %d, data = ", sDiscrim);
        !            24:     switch(sDiscrim) {
        !            25:        case 0:
        !            26:            printf("short %d\n", up.sVal);
        !            27:            return(TRUE);
        !            28:            break;
        !            29:        case 1:
        !            30:            printf("float %f\n", up.fVal);
        !            31:            return(TRUE);
        !            32:            break;
        !            33:        case 2:
        !            34:            printf("char %c\n", up.chVal);
        !            35:            return(TRUE);
        !            36:            break;
        !            37:        default:
        !            38:            return(FALSE);
        !            39:            break;
        !            40:      }
        !            41: }
        !            42: 
        !            43: short UnionStructProc(
        !            44:    DISCRIM_UNION_STRUCT_TYPE u)
        !            45: {
        !            46:     printf("sDiscrim = %d, data = ", u.sDiscrim);
        !            47:     switch(u.sDiscrim) {
        !            48:        case 0:
        !            49:            printf("short %d\n", u.u.sVal);
        !            50:            return(TRUE);
        !            51:            break;
        !            52:        case 1:
        !            53:            printf("float %f\n", u.u.fVal);
        !            54:            return(TRUE);
        !            55:            break;
        !            56:        case 2:
        !            57:            printf("char %c\n", u.u.chVal);
        !            58:            return(TRUE);
        !            59:            break;
        !            60:        default:
        !            61:            return(FALSE);
        !            62:            break;
        !            63:      }
        !            64: }
        !            65: 
        !            66: void Shutdown(void)
        !            67: {
        !            68:     RPC_STATUS status;
        !            69: 
        !            70:     printf("Calling RpcMgmtStopServerListening\n");
        !            71:     status = RpcMgmtStopServerListening(NULL);
        !            72:     printf("RpcMgmtStopServerListening returned: 0x%x\n", status);
        !            73:     if (status) {
        !            74:         exit(2);
        !            75:     }
        !            76: 
        !            77:     printf("Calling RpcServerUnregisterIf\n");
        !            78:     status = RpcServerUnregisterIf(NULL, NULL, FALSE);
        !            79:     printf("RpcServerUnregisterIf returned 0x%x\n", status);
        !            80:     if (status) {
        !            81:         exit(2);
        !            82:     }
        !            83: }
        !            84: 
        !            85: /* end of file \dunionp.c */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.