CAN Implementation Proxy Module - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

CAN Implementation Proxy Module

Description:

The Role of Proxy - Proxy plays as the bridge between CAN nodes to client. ... parse buf; return content; } Return Message Format ... – PowerPoint PPT presentation

Number of Views:245
Avg rating:3.0/5.0
Slides: 12
Provided by: qcao
Category:

less

Transcript and Presenter's Notes

Title: CAN Implementation Proxy Module


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 MsgType1.
  • 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. Its
    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
  • byte20 UUIDUUIDgen()
  • byte20 p SHA(key)
  • packing message SendMsg(buf,
    IP, 1)
  • bool reply RecvMsg(UUID)
  • return reply(T/F)

9
Pseudo Code - GetContent
  • byte20 UUIDUUIDgen()
  • byte20 p SHA(key)
  • packing message SendMsg(buf,
    IP, 1)
  • bool reply RecvMsg(UUID)
  • return reply(T/F)

10
Pseudo Code - DeleteContent
  • byte20 UUIDUUIDgen()
  • byte20 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.
Write a Comment
User Comments (0)
About PowerShow.com