1 / 10

第十一章 高階應用程式介面 - RPC

第十一章 高階應用程式介面 - RPC. 11-1 RPC 簡介 11-2 RPC 協定架構 11-3 RPC 運作方式 11-4 RPC 程式開發 11-5 RPC 庫存函數 11-6 XDR 資料表示協定 11-7 RPC 安全性. 11-1 RPC 簡介 ( 一 ). 本地程序呼叫 (Local Procedure Call, LPC) 同一主機電腦內的程序呼叫. 11-1 RPC 簡介 ( 二 ). 遠端程序呼叫 (Remote Procedure Call, RPC) 遠端電腦程序呼叫

karlyn
Télécharger la présentation

第十一章 高階應用程式介面 - RPC

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. 第十一章 高階應用程式介面 - RPC • 11-1 RPC 簡介 • 11-2 RPC 協定架構 • 11-3 RPC 運作方式 • 11-4 RPC 程式開發 • 11-5 RPC 庫存函數 • 11-6 XDR 資料表示協定 • 11-7 RPC 安全性

  2. 11-1 RPC 簡介 (一) • 本地程序呼叫 (Local Procedure Call, LPC) • 同一主機電腦內的程序呼叫

  3. 11-1 RPC 簡介 (二) • 遠端程序呼叫 (Remote Procedure Call, RPC) • 遠端電腦程序呼叫 • 資料庫伺服器 (Database Server)

  4. 11-2 RPC 協定架構 • 應用層:Client/Server 資料庫伺服系統 • 表現層: • 外部資料表示法 (eXternal Data Representation, XDR) • 抽象語意表示 (ASN.1) • 交談層:實現 RPC 系統 • 傳輸層:TCP 或 UDP 協定 • 網路層:IP 協定 • 鏈路層與實體層:一般網路,如 Ethernet 網路

  5. 11-3 RPC 運作方式 (一) • RPC 連線方式 • 當伺服程式 (RPC Server) 啟動時,便向 Portmap  註冊本身的傳輸埠口。 • 客戶端如欲呼叫遠端程式,首先向 Portmap 查詢傳輸埠口位置。 • 客戶端得到埠口位址後,便可直接連結伺服程式。

  6. 11-3 RPC 運作方式 (二) • RPC 程序呼叫方式 • Server Stub • Client Stub

  7. 編寫 RPC 規格檔:date.x 利用 rpcgen  編譯規格檔 $ rpcgen date.x   會產生四個檔案: 標頭檔:date.h Server Stub : date_svc.c  Client Stub : date_cln.c 資料格式轉換檔 : date_xdr.c 3. 編寫遠端程序:date_proc.c (linux-2 163.15.2.30) $ cc -o date_proc date_proc.c date_svc.c date_xdr.c -lnsl 4. 編寫客戶端主程式: rdate.c  (linux-2 163.15.2.62) $ cc -o rdate rdate.c date_clnt.c date_xdr.c -lnsl 5. 遠端程序執行  (linux-2 163.15.2.30)  $ date_proc  & 6. 客戶端程序呼叫  (linux-2 163.15.2.62) $ rdate 163.15.2.30 11-4 RPC 程式開發 (一)

  8. 11-5 RPC 庫存函數 • 伺服端庫存函數 • 開啟 TCP 的 RPC 連線:svctcp_create() • 開啟 UDP 的 RPC 連線 : svcudp_create() • 客戶端庫存函數 • 開啟通訊連線:clnt_cerate() • 關閉通訊連線:clnt_destory() • 通訊連線控制:clnt_control() • 呼叫遠端程序:clnt_call() • 其它功能呼叫: clnt_pcreateerror(), clnt_perror(), clnt_freeres()

  9. 11-6 XDR 資料表示協定 • 外部資料表示   (eXternal Data Representation, XDR) • 資料長度 • 位元組順序 • 資料表示 • 序列

  10. 11-7 RPC 安全性 • None : 無安全錯誤 • Unix : 以 Unix 作業方式 • Secure : Secure RPC

More Related