Presentation Formatting - PowerPoint PPT Presentation

1 / 26
About This Presentation
Title:

Presentation Formatting

Description:

Unmarshalling (decoding) messages into application data. application. data. application ... Decoding. message. message. message. Data Types. Data types we ... – PowerPoint PPT presentation

Number of Views:24
Avg rating:3.0/5.0
Slides: 27
Provided by: markc195
Category:

less

Transcript and Presenter's Notes

Title: Presentation Formatting


1
Presentation Formatting
2
Overview
  • Marshalling (encoding) application data into
    messages
  • Unmarshalling (decoding) messages into
    application data

3
Data Types
  • Data types we consider
  • integers
  • floating point numbers
  • character strings
  • arrays
  • structures
  • Types of data we do not consider (now)
  • images
  • video
  • multimedia documents

4
Difficulties
  • Representation of base types
  • floating point IEEE 754 versus non-standard
  • integer big-endian versus little-endian
  • Compiler layout of structures

(0)
(0)
(0)
(2)
big endian
00000010
00000000
00000000
00000000
(2)
(0)
(0)
(0)
little endian
00000010
00000000
00000000
00000000
0
1
2
3
Low
High
Address
address
5
Taxonomy
  • Data types
  • base types (e.g., ints, floats) must convert
  • flat types (e.g., structures, arrays) must pack
  • complex types (e.g., pointers) must linearize
  • Conversion Strategy
  • canonical intermediate form
  • receiver-makes-right (an N x N solution)
  • N machine architectures must be able to handle N
    representations

6
Marshalling
Application Data Structure
Argument Marshaller
7
Tagged versus Untagged data
  • Stubs
  • compiled
  • interpreted
  • CORBA

8
Examples
  • XDR eXternal Data Representation
  • Defined by Sun for use with SunRPC
  • C type system (without function pointers)
  • Canonical intermediate form
  • Untagged (except array length)
  • Compiled stubs

9
  • define MAXNAME 256
  • define MAXLIST 100
  • struct item
  • int count
  • char nameMAXNAME
  • int listMAXLIST
  • bool_t
  • xdr_item(XDR xdrs, struct item ptr)
  • return(xdr_int(xdrs, ptr-gtcount)
  • xdr_string(xdrs, ptr-gtname,MAXNAME)
  • xdr_array(xdrs, ptr-gtlist, ptr-gtcount, MAXLIST,
    sizeof(int), xdr_int))

10
XDR
70MBps attainable on 175MHz Alpha
11
Abstract Syntax Notation ASN.1
  • (tag-8 bits, length-8bits, value)
  • Used by Simple Network Management Protocol (SNMP)
  • Canonical Intermediate form
  • Length0x82 01 01257
  • Each call sends 3 bytes

12
NDR Network Data Representation
  • Defined by DCE (CORBA)
  • Essentially the C type system
  • Receiver-makes-right (architecture tag)
  • Individual data items untagged
  • Compiled stubs from Interface Definition Language
    (IDL)

13
4-byte architecture definition tag
  • IntegrRep
  • 0 big-endian
  • 1 little-endian
  • CharRep
  • 0 ASCII
  • 1 EBCDIC
  • FloatRep
  • 0 IEEE 754
  • 1 VAX
  • 2 Cray
  • 3 IBM

14
Remote Procedure Calls
15
Overview
16
Mechanics
17
Address Space for Procedures
  • Flat unique id for each possible procedure
  • Hierarchical program procedure within program

18
SunRPC
  • UDP SunRPC implement
  • UDP dispatches to program (ports bound to
    programs)
  • SunRPC dispatches to procedure w/in program

19
Implementation
  • Port Mapper program exists at well known UDP port
    (111)
  • The Port Mapper translates program numbers (32
    bits) to UDP port numbers
  • The 32 bit procedure number is then used to make
    the remote call
  • NFS read procedure 6

20
SunRPC Header Format
21
(No Transcript)
22
RPC Lab
  • Write code to implement open, read and write
    commands to remote file
  • You pass off against your own code
  • The TA code is there to give you an example of
    how things might work
  • Can be implemented on top of IP if TCP isnt
    complete

23
Overview
Server
Client
Main() calls rpcopen(file)
RPC creates message and sends To TCP
Pop decodes RPC_OPEN, calls fdopen(file)
fd Handle
1 12
14 3
24
Overview
Server
Client
Main() calls rpcread(Handle, buf, len)
RPC creates message and sends To TCP Waits on
semaphore
Pop decodes RPC_READ calls rvalread(fd,tmpb,len)

rpcpop copies data from message into buf,
signals semaphore
25
Server
Client
Overview
Main() calls rpcwrite(Handle, buf, len)
RPC creates message and sends To TCP, waits on
semaphore
Pop decodes RPC_WRITE calls rvalwrite(fd,tmpb,le
n)
rpcpop signals semaphore
26
Details
  • Passoff
  • Open remote file
  • Read from within file
  • Read beyond end (you should only return amount
    actually available)
  • Write beyond end
  • Read total data
  • Copy new version of test file before each run.
Write a Comment
User Comments (0)
About PowerShow.com