|
|
1.1 root 1: /*************************************************************/
2: /** **/
3: /** Microsoft RPC Examples **/
4: /** Dictionary Application **/
1.1.1.2 root 5: /** Copyright(c) Microsoft Corp. 1992 **/
1.1 root 6: /** **/
7: /*************************************************************/
8:
9: /*
10: *************************************************************************
11: * *
1.1.1.4 ! root 12: * Remote dictionary example: server side *
1.1 root 13: * *
14: * Description: *
15: * This is the driver for the server side remote dictionary *
16: * (splay trees based) demo. This is a standard server driver, *
17: * and it works as follows: *
18: * *
19: * o Call RpcCreateServer to initialize all data structures *
20: * *
21: * o Initialize an appropriate protocol stack *
22: * *
23: * o Call RpcAddAddress to start listening on a transport address *
24: * (a named pipe in our case). *
25: * *
26: * o Call RpcAddInterface to initialize interface specific structures *
27: * (such as dispatch table, etc.) *
28: * *
29: * o Optionally advertise by calling RpcExport (not in this version) *
30: * *
31: * o Loop forever... *
32: * *
33: *************************************************************************
34: */
35:
36: #include <stdlib.h>
1.1.1.4 ! root 37: #include <stdio.h>
1.1 root 38: #include <ctype.h>
39:
1.1.1.4 ! root 40: #include "replay.h" // header file generated by MIDL compiler
1.1 root 41: #include "dict0.h"
42: #include "util0.h"
43:
1.1.1.2 root 44:
1.1 root 45: void Usage()
46: {
1.1.1.4 ! root 47: printf("Usage : server -e <endpoint>\n");
1.1 root 48: exit(1);
49: }
50:
1.1.1.3 root 51: void _CRTAPI1
1.1 root 52: main(int argc, char *argv[])
53: {
1.1.1.4 ! root 54: RPC_STATUS status;
! 55: unsigned char * pszProtocolSequence = "ncacn_np";
! 56: unsigned char * pszSecurity = NULL;
! 57: unsigned char * pszEndpoint = "\\pipe\\dict";
! 58: unsigned int cMinCalls = 1;
! 59: unsigned int cMaxCalls = 20;
! 60: unsigned int fDontWait = FALSE;
! 61: int i;
! 62:
! 63: printf ("Microsoft RPC demo Server - Splay (Binary) Tree DataBase\n");
! 64:
! 65: /* allow the user to override settings with command line switches */
! 66: for (i = 1; i < argc; i++) {
! 67: if ((*argv[i] == '-') || (*argv[i] == '/')) {
! 68: switch (tolower(*(argv[i]+1))) {
! 69: case 'e':
! 70: pszEndpoint = argv[++i];
1.1 root 71: break;
1.1.1.4 ! root 72: case 'h':
! 73: case '?':
! 74: default:
1.1 root 75: Usage();
76: }
77: }
1.1.1.4 ! root 78: else
! 79: Usage();
1.1 root 80: }
81:
1.1.1.4 ! root 82: status = RpcServerUseProtseqEp(pszProtocolSequence,
! 83: cMaxCalls,
! 84: pszEndpoint,
! 85: pszSecurity); // Security descriptor
! 86: if (status) {
! 87: printf("RpcServerUseProtseqEp returned 0x%x\n", status);
! 88: exit(status);
! 89: }
1.1 root 90:
1.1.1.4 ! root 91: status = RpcServerRegisterIf(dict_ServerIfHandle, // interface to register
! 92: NULL, // MgrTypeUuid
! 93: NULL); // MgrEpv; null means use default
! 94: if (status) {
! 95: printf("RpcServerRegisterIf returned 0x%x\n", status);
! 96: exit(status);
! 97: }
1.1.1.2 root 98:
1.1.1.4 ! root 99: printf("Calling RpcServerListen\n");
! 100: status = RpcServerListen(cMinCalls,
! 101: cMaxCalls,
! 102: fDontWait);
! 103: if (status) {
! 104: printf("RpcServerListen returned: 0x%x\n", status);
! 105: exit(status);
! 106: }
1.1.1.2 root 107:
1.1 root 108: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.