presentation formatting n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Presentation Formatting PowerPoint Presentation
Download Presentation
Presentation Formatting

Loading in 2 Seconds...

play fullscreen
1 / 26

Presentation Formatting - PowerPoint PPT Presentation


  • 56 Views
  • Uploaded on

Presentation Formatting. application. application. data. data. Presentation. Presentation. Encoding. Decoding. . . . message. message. message. Overview. Marshalling (encoding) application data into messages Unmarshalling (decoding) messages into application data.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

Presentation Formatting


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
overview

application

application

data

data

Presentation

Presentation

Encoding

Decoding

. . .

message

message

message

Overview
  • Marshalling (encoding) application data into messages
  • Unmarshalling (decoding) messages into application data
data types
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
difficulties
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

00000000

00000000

00000000

00000010

(2)

(0)

(0)

(0)

little endian

00000010

00000000

00000000

00000000

0

1

2

3

Low

High

Address

address

taxonomy
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
marshalling
Marshalling

Application Data Structure

Argument Marshaller

tagged versus untagged data

INT

4

4byte integer

Interface

Descriptor for

Call

Procedure P

P

P

Spec

arguments

arguments

Code

Code

Client

Stub

Server

Stub

Compiler

Stub

marshalled

marshalled

arguments

arguments

RPC

RPC

message

Tagged versus Untagged data
  • Stubs
    • compiled
    • interpreted
    • CORBA
examples
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
slide9
#define MAXNAME 256;

#define MAXLIST 100;

struct item {

int count;

char name[MAXNAME];

int list[MAXLIST];

};

bool_t

xdr_item(XDR *xdrs, struct item *ptr)

{

return(xdr_int(xdrs, &ptr->count) &&

xdr_string(xdrs, &ptr->name,MAXNAME) &&

xdr_array(xdrs, &ptr->list, &ptr->count, MAXLIST, sizeof(int), xdr_int));

}

slide10

count

name

3

7

J

O

H

N

S

O

N

list

3

497

8321

265

XDR

70MBps attainable on 175MHz Alpha

abstract syntax notation asn 1
Abstract Syntax Notation ASN.1
  • (tag-8 bits, length-8+bits, value)
  • Used by Simple Network Management Protocol (SNMP)
  • Canonical Intermediate form
  • Length=0x82 01 01=257
  • Each call sends 3 bytes
ndr network data representation

Integer

Char

FloatRep

Extension 1

Extension 2

Rep

Rep

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)
4 byte architecture definition tag
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
overview1

Client

Server

blocked

request

blocked

computing

reply

blocked

Overview
mechanics

caller

callee

(client)

(server)

return

return

args

args

value

value

client

server

stub

stub

reply

reply

req

req

RPC

RPC

Protocol

Protocol

network

Mechanics
address space for procedures
Address Space for Procedures
  • Flat: unique id for each possible procedure
  • Hierarchical: program + procedure within program
sunrpc

SUNRPC

UDP

IP

ETH

SunRPC
  • UDP + SunRPC implement
    • UDP dispatches to program (ports bound to programs)
    • SunRPC dispatches to procedure w/in program
implementation
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
sunrpc header format

XID

XID

MsgType

MsgType

= CALL

= REPLY

RPCVersion

Status =

= 2

ACCEPTED

Program

Version

Procedure

Credentials

(variable)

Verifier

(variable)

SunRPC Header Format
rpc lab
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 isn’t complete
overview2

“file”

“file”

RPC_OPEN

RPC_OPEN

Call

Response

RPC_OPEN

Handle

Overview

Server

Client

Main() calls rpc::open(“file”);

RPC creates message and sends

To TCP

Pop decodes RPC_OPEN,

calls fd=open(“file”);

overview3

len

Handle

RPC_READ

Call

Response

RPC_READ

tmpb data

rval

Overview

Server

Client

Main() calls rpc::read(Handle, buf, len)

RPC creates message and sends To TCP

Waits on semaphore

Pop decodes RPC_READ

calls rval=read(fd,tmpb,len);

rpc::pop copies data from message

into buf, signals semaphore

slide25

buf data

len

Handle

RPC_WRITE

Call

Response

RPC_WRITE

Server

Client

Overview

Main() calls rpc::write(Handle, buf, len)

RPC creates message and sends

To TCP, waits on semaphore

Pop decodes RPC_WRITE

calls rval=write(fd,tmpb,len);

rpc::pop signals semaphore

details
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.