Annotation of mstools/samples/rpc/data/xmit/xmitp.c, revision 1.1.1.1

1.1       root        1: /****************************************************************************
                      2:                        Microsoft RPC Version 1.0
                      3:                      Copyright Microsoft Corp. 1992
                      4:                               xmit Example
                      5: 
                      6:     FILE:      xmitp.c
                      7:     PURPOSE:    Remote procedures that are linked with the server
                      8:                side of RPC distributed application
                      9:     FUNCTIONS: ModifyListProc() - changes the doubly-linked list
                     10:                Shutdown() - shuts down the server side
                     11:     COMMENTS:  Linked with xmits.c
                     12: 
                     13: ****************************************************************************/
                     14: #include <stdlib.h>
                     15: #include <stdio.h>
                     16: 
                     17: #include <rpc.h>
                     18: #include <rpcndr.h>
                     19: #include "xmit.h"     // header file generated by MIDL compiler
                     20: 
                     21: 
                     22: /****************************************************************************
                     23: Function:   ModifyListProc
                     24: 
                     25: Parameters: pFirst : Pointer to the head of a doubly-linked list.
                     26: 
                     27: Returns:    none
                     28: 
                     29: Purpose:    Display the list passed to the function.
                     30:            For each element in the list, add another element.
                     31:            Display the modified list.
                     32: 
                     33: Comments:   This sample is meant to demonstrate a typical use of the
                     34:            transmit_as attribute:  A complex data structure is simplified
                     35:            for transmission over the network, restored on the server,
                     36:            then manipulated by the remote function on the server.
                     37:            The modified data is returned to the client.
                     38: 
                     39:            Calls InsertNewNode(param1, param2), a utility routine
                     40:            in xmits.c that creates a new node, assigns to it the
                     41:            value param1, and inserts it into the list after param2.
                     42: ****************************************************************************/
                     43: DOUBLE_LINK_TYPE * InsertNewNode(short sValue, DOUBLE_LINK_TYPE * pPrevious);
                     44: 
                     45: void ModifyListProc(DOUBLE_LINK_TYPE * pFirst)
                     46: {
                     47:     DOUBLE_LINK_TYPE * pList = pFirst;
                     48:     printf("ModifyListProc: Display contents of doubly linked list:\n");
                     49:     while (pList != NULL) {
                     50:        printf("pList @0x%x = %d, Next = 0x%x\n", pList, pList->sNumber, pList->pNext);
                     51:        pList = pList->pNext;
                     52:     }
                     53:     printf("ModifyListProc: Add one node for every node in tree\n");
                     54:     for (pList = pFirst; pList != NULL; pList = pList->pNext) {
                     55:        pList = InsertNewNode(pList->sNumber + (short) 1, pList);
                     56:     }
                     57:     printf("ModifyListProc: Display modified contents of doubly linked list:\n");
                     58:     for (pList = pFirst; pList != NULL; pList = pList->pNext)
                     59:        printf("pList @0x%x = %d, Next = 0x%x\n", pList, pList->sNumber, pList->pNext);
                     60: }
                     61: 
                     62: /****************************************************************************
                     63: Function:   Shutdown
                     64: 
                     65: Parameters: none
                     66: 
                     67: Returns:    none
                     68: 
                     69: Purpose:    Make the server stop listening for client applications.
                     70: Comments:   The two NULL parameters passed to RpcServerUnregisterIf are
                     71:            a show of brute force:  they tell the function to turn
                     72:            off all registered interfaces.  See the RPC API function
                     73:            reference for more information about these functions.
                     74: ****************************************************************************/
                     75: 
                     76: 
                     77: void Shutdown(void)
                     78: {
                     79:     RPC_STATUS status;
                     80: 
                     81:     printf("Calling RpcMgmtStopServerListening\n");
                     82:     status = RpcMgmtStopServerListening(NULL);
                     83:     printf("RpcMgmtStopServerListening returned: 0x%x\n", status);
                     84:     if (status) {
                     85:         exit(2);
                     86:     }
                     87: 
                     88:     printf("Calling RpcServerUnregisterIf\n");
                     89:     status = RpcServerUnregisterIf(NULL, NULL, FALSE);
                     90:     printf("RpcServerUnregisterIf returned 0x%x\n", status);
                     91:     if (status) {
                     92:         exit(2);
                     93:     }
                     94: }
                     95: 
                     96: /* end of file xmitp.c */

unix.superglobalmegacorp.com

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