1 / 11

CAN Implementation– Proxy Module

CAN Implementation– Proxy Module. Qun Cao October 14, 2002. CAN Infrastructure. Replicate Manager. Message. Message Dispatcher. Node Manager. Lookup result. Content Manager. PROXY. PROXY. DB. Message. Communication Engine. Routing Manager. Next Node. Proxy Module.

Download Presentation

CAN Implementation– Proxy Module

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. CAN Implementation– Proxy Module Qun Cao October 14, 2002

  2. CAN Infrastructure Replicate Manager Message Message Dispatcher Node Manager Lookup result Content Manager PROXY PROXY DB Message Communication Engine Routing Manager Next Node

  3. Proxy Module • The Role of Proxy - Proxy plays as the bridge between CAN nodes to client. The CAN internal structure is transparent to client. Proxy serves as a web service to the client. - Proxy collects information from client and make a CAN message package for the usage of other CAN modules.

  4. Proxy API • namespace MyCAN{ public class Proxy { public Proxy() { } public bool AddContent (string Key, byte[] value) { …} public byte[] GetContent(string key) { …} public bool DeleteContent(string key) {… } } }

  5. CAN Internal Message • Works as the standard message flowing between CAN modules, carries all the information of client request, generated by Proxy Module. • Structure: • * a.l : arbitrary length. If an item is a.l, we use the first 4 bytes to store its length and followed by its content.

  6. Message Format • MsgType (4 bytes): The message dispatcher dispatches this message to the appropriate module in term of MsgType. All content-related messages have MsgType=1. • OP (4 bytes): Content manager uses this type to perform add, delete, and lookup operations. We define OP Operations 1 Add a piece of content 2 Delete a piece of content 3 Lookup a piece of content

  7. Message Format • P (20 bytes): P= SHA(key). • Key (a.l): a string with arbitrary length. It’s used in add, delete and lookup a piece of content. • SrcIP (4 bytes): the IP address of the proxy instance who issues the message. • SrcMsgChannel (20 bytes): The message channel where this proxy instance receives messages. Other CAN nodes who receive this message may use the SrcIP and SrcMsgChannel to send messages back to this particular proxy instance. SrcMsgChannel is generated by some UUID generation algorithm. • Value (a.l): a byte array containing the value of a piece of content.

  8. Pseudo Code - AddContent • { byte[20] UUID=UUIDgen(); byte[20] p = SHA(key); packing message; SendMsg(buf, IP, 1); bool reply = RecvMsg(UUID); return reply(T/F); }

  9. Pseudo Code - GetContent • { byte[20] UUID=UUIDgen(); byte[20] p = SHA(key); packing message; SendMsg(buf, IP, 1); bool reply = RecvMsg(UUID); return reply(T/F); }

  10. Pseudo Code - DeleteContent • { byte[20] UUID=UUIDgen(); byte[20] p = SHA(key); packing message; SendMsg(buf, IP, 1); byte[] buf = RecvMsg(UUID); parse buf; return content; }

  11. Return Message Format • The operation result message issued from CAN nodes to Proxy • Structure: OP ResultCode Description value • OP (4 bytes): It has the same meaning as the above OP. ResultCode (1 byte): 1 indicates the operation succeeds. 0 indicates it fails. Description (a.l): A description string to the result code. For example, if ResultCode is 0, this string describes the error in detail. Value (a.l.): The value for the key, if OP is 3.

More Related