1 / 18

CS603 Communication Mechanisms

CS603 Communication Mechanisms. 18 January 2002. What is coming. Remote procedure call – specific systems DCE RPC Java RMI SOAP First project. Distributed Computing Environment. DCE: Evolved from CMU research project Same folks that produced AFS

Anita
Download Presentation

CS603 Communication Mechanisms

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS603Communication Mechanisms 18 January 2002

  2. What is coming • Remote procedure call – specific systems • DCE RPC • Java RMI • SOAP • First project

  3. Distributed Computing Environment • DCE: Evolved from CMU research project • Same folks that produced AFS • Incorporates Kerberos, other research projects • Includes several components for building distributed systems • Naming (X.500,DNS) • Authentication (Kerberos) • Data sharing (AFS) • Clock Synchronization (NTP) • Distributed applications (RPC) • Thread support (POSIX based)

  4. DCE RPC • System independent • Runs over multiple protocols • Core feature set implemented on each system • Language independent • Procedures declared in Interface Description Language • Produces stubs that “stand in” for procedure on local system

  5. DCE RPC mechanism

  6. DCE RPCComponents • IDL Compiler • Produces stubs that “fit” with native code • Run-time • Responds to requests by stubs • Data Conversion • Handles differences between systems

  7. IDL Compiler • IDL is C-like language for specifying semantics of a procedure • Includes some special network support • Example: “Autobind” – declares that procedure will find an execute on another server should the first one fail • Compiles into stubs that are viewed as local procedures on each host

  8. DCE RPCRun-time System • Directory Services • RPC not tied to specific machine name • Network-independent • Hides details of network from RPC applications • Reliability • Manages failure/recovery • Security / Authentication

  9. DCE RPCData Conversion • Caller and callee may have different data representations • Byte order • Structure • Character Set • One solution: Convert to canonical form • Conversion done everywhere • DCE RPC: Leave in native form • Tag with description of native form • Convert on demand • Conversion handled by stub

  10. Building a DCE RPC Application

  11. Sample IDL formessage/reply RPC /* greet.idl * The "greet" interface. */ [uuid(3d6ead56-06e3-11ca-8dd1-826901beabcd), version(1.0)] /* import “like_c_includes.idl” */ /* type declarations (typedef) */ interface greetif { const long int REPLY_SIZE = 100; void greet( [in] handle_t h, [in, string] char client_greeting[], [out, string] char server_reply[REPLY_SIZE] ); }

  12. Interface Attributes [uuid(3d6ead56-06e3-11ca-8dd1-826901beabcd), version(1.0)] • Uuid is required global unique identifier, created with ‘uuidgen’ command • Other attributes: • Version • Endpoint (e.g., if procedure on known machine)

  13. Operation Attributes Idempotent void greet( [in] handle_t h, [in, string] char client_greeting[], [out, string] char server_reply[REPLY_SIZE] ); • First parameter is binding • Explicit (if first parameter is type handle_t) • From configuration file • Automatic • At-most-once • Idempotent (safe to call more than once) • Broadcast – try all servers, only one result to client • Maybe – no response, no guarantee or notice of completion

  14. Using defined interface:Client /* greet_client.c - Client of "greet" interface. usage: greet_client <CDS pathname>*/ #include <stdio.h> #include <dce/rpc.h> #include "greet.h“ #include "util.h" Int main(int argc, char *argv[]) { rpc_ns_handle_t import_context; handle_t binding_h; error_status_t status; idl_char reply[REPLY_SIZE]; /* Start importing servers using the name specified on the command line. */ rpc_ns_binding_import_begin(rpc_c_ns_syntax_default, (unsigned_char_p_t) argv[1], greetif_v1_0_c_ifspec, NULL, &import_context, &status); ERROR_CHECK(status, "Can't begin import"); /* Import the first server (we could iterate here, but we'll just take the first one). */ rpc_ns_binding_import_next(import_context, &binding_h, &status); ERROR_CHECK(status, "Can't import"); /* Make the remote call. */ greet(binding_h, (idl_char *) "hello, server", reply); printf("The Greet Server said: %s\n", reply); }

  15. Using defined interface:Server /* greet_manager.c - Implementation of "greet" interface. */ #include <stdio.h> #include "greet.h" void greet( handle_t h, idl_char *client_greeting, idl_char *server_reply ) { printf("The client says: %s\n", client_greeting); strcpy(server_reply, "Hi, client!"); }

  16. CS603Communication Mechanisms 23 January 2002

  17. Using defined interface:Setting up listener /* greet_server.c - usage: greet_server <CDS pathname> */ #include <stdio.h> #include <dce/dce_error.h> #include <dce/rpc.h> #include "greet.h" #include "util.h" Int main(int argc, char *argv[]) { unsigned32 status; rpc_binding_vector_t *binding_vector; /* Register interface with RPC runtime. */ rpc_server_register_if(greetif_v1_0_s_ifspec, NULL, NULL, &status); ERROR_CHECK(status, "Can't register interface"); /* Use all protocol sequences that are available. */ rpc_server_use_all_protseqs(rpc_c_protseq_max_reqs_default, &status); ERROR_CHECK(status, "Can't use protocol sequences"); /* Get the binding handles generated by the runtime. */ rpc_server_inq_bindings(&binding_vector, &status); ERROR_CHECK(status, "Can't get bindings for server");

  18. Using defined interface:Server /* Register assigned endpoints with endpoint mapper. */ rpc_ep_register(greetif_v1_0_s_ifspec, binding_vector, NULL, (unsigned_char_p_t) "greet server version 1.0", &status); ERROR_CHECK(status, "Can't register with endpoint map"); /* Export ourselves into the CDS namespace. */ rpc_ns_binding_export( rpc_c_ns_syntax_default, (unsigned_char_p_t) argv[1], greetif_v1_0_s_ifspec, binding_vector, NULL, &status); ERROR_CHECK(status, "Can't export into CDS namespace"); /* Start listening for calls. */ printf("Listening...\n"); rpc_server_listen(rpc_c_listen_max_calls_default, &status); ERROR_CHECK(status, "Can't start listening for calls"); }

More Related