home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / mach / doc / unpublished / mig_example / random.defs.Z / random.defs
Encoding:
Text File  |  1989-11-01  |  1.6 KB  |  52 lines

  1. /**************************************************************
  2.  *  random.defs 
  3.  *    Defines a  server to return random numbers, random strings
  4.  *    and pages of memory filled with random junk.
  5.  *************************************************************/
  6. subsystem random 500;
  7. #include <mach/std_types.defs>
  8.  
  9. type dbl    = struct [2] of int;
  10. type string25    = (MSG_TYPE_STRING,8*25); /* passed by reference */
  11. type string80    = struct [1] of array [80] of char; /* passed by value */
  12. type words    = ^ array [ ] of int;
  13. type words256    = array [256] of int;
  14. type comp_arr    = array [10] of array [256] of int;
  15. type page_ptr    = ^array [4096] of MSG_TYPE_INTEGER_32;
  16.  
  17. import "random_types.h";
  18.  
  19. procedure init_seed (     server_port    : port_t;
  20.             seed        : dbl);
  21.  
  22. function get_randomf(    server_port    : port_t) 
  23.     : int;
  24.  
  25. routine get_random(    server_port    : port_t;
  26.             out num        : int);
  27.  
  28. msgtype MSG_TYPE_ENCRYPTED;  /* get secret string */
  29. waittime 10000;  /* next call may go to a server on another machine */
  30.  
  31. routine get_secret(    server_port    : port_t;
  32.           inout password    : string25);
  33.  
  34. /* input waittime to next procedure in case 10 seconds is not long enough */
  35. /* mtype can be input as MSG_TYPE_NORMAL if encryption is  not wanted */
  36.  
  37. routine get_confidential(server_port    : port_t;
  38.         waittime wait        : int; 
  39.              MsgType mtype        : int;
  40.              out data        : page_ptr,dealloc);
  41.  
  42. nowaittime;
  43. msgtype MSG_TYPE_NORMAL;
  44.  
  45. simpleroutine use_random(server_port    : port_t;
  46.             info_seed    : string80;
  47.             info        : comp_arr;
  48.             info_1        : words);    
  49.         
  50. /* tell server you are finished using it */
  51. simpleprocedure  exit(    server_port    : port_t);
  52.