eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'SunRPC::XDRCoder':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: XDRCoder (in SunRPC)


Inheritance:

   Object
   |
   +--SunRPC::XDRCoder

Package:
stx:goodies/communication
Category:
Net-Communication-SunRPC
Version:
rev: 1.28 date: 2023/09/07 11:26:52
user: cg
file: SunRPC_XDRCoder.st directory: goodies/communication
module: stx stc-classLibrary: communication

Description:


XDR (eXternal Data Representation) encoder and decoder.
Encodes/decodes objects to/from the wire-protocol format.
Only a limited subset of object types is supported (see XDR documentation)

    

copyright

COPYRIGHT (c) 2001 by eXept Software AG All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

Class protocol:

instance creation
o  from: data

o  new
(comment from inherited method)
return an instance of myself without indexed variables


Instance protocol:

accessing
o  contents
return the data buffered so far

Usage example(s):

     (self new
        uint:16r12345678;
        contents) printOn:Transcript base:16

decoding
o  decodeArrayWithType: arrayType

o  decodeBoolean

o  decodeChar

o  decodeInt

o  decodeLong

o  decodeOpaqueWithType: stringType
fixed size

o  decodeOptionalWithType: optionalType

o  decodeShort

o  decodeStringWithType: stringType
fixed size

o  decodeStructWithType: structType

o  decodeStructWithType: structType ignoreLast: ignoreLast

o  decodeUnionWithType: unionType
must be enum then

o  decodeUnsignedChar

o  decodeUnsignedInt

o  decodeUnsignedLong

o  decodeUnsignedShort

encoding
o  decodeEnumWithType: enumType

o  encodeArray: anArray type: arrayType with: aParameter

o  encodeBoolean: value with: aParameter

o  encodeChar: value with: aParameter

o  encodeEnum: value type: enumType with: aParameter

o  encodeInt: value with: aParameter

o  encodeLong: value with: aParameter

o  encodeOpaque: value type: opaqueType with: dummyParameter
fixed size

o  encodeOptional: value type: optionalType with: dummyParameter

o  encodeShort: value with: aParameter

o  encodeString: value type: stringType with: dummyParameter
fixed size

o  encodeStruct: value type: structType with: dummyParameter

o  encodeStruct: value type: structType with: dummyParameter ignoreLast: ignoreLast

o  encodeUnion: value type: unionType with: dummyParameter
must be enum then

o  encodeUnsignedChar: value with: aParameter

o  encodeUnsignedInt: value with: aParameter

o  encodeUnsignedLong: value with: aParameter

o  encodeUnsignedShort: value with: aParameter

o  encodeVoid: value with: aParameter
nothing encoded for void

initialization
o  initialize
(comment from inherited method)
just to ignore initialize to objects which do not need it

o  initializeFor: data

packing
o  packArray: aCollection using: selector
self new
packArray:#(1 2 3) using:#uint:;
contents

o  packBool: aBool
self new
packBool:true;
contents

o  packDouble: aFloat
self new
packDouble:1.2345;
contents

o  packEnum: aNumberOrSymbol

o  packFloat: aFloat
self new
packFloat:1.2345;
contents

o  packHyper: aNumber
self new
packHyper:-1;
contents

o  packInt: aNumber
self new
packInt:-1;
contents

o  packList: aCollection using: selectorOrBlock
self new
packList:#(1 2 3) using:#packUint:;
contents

o  packList: aCollection using: selectorOrBlock with: aParameter

o  packOpaque: something
self new
packOpaque:'abcdefg';
contents

o  packString: aString
self new
packString:'abcdefg';
contents

o  packUhyper: aLongNumber
self packUnsignedHyper:aLongNumber.

Usage example(s):

     self new
        packUhyper:16r123456789abcdef0;
        contents     

o  packUint: aNumber
self packUnsignedInt:aNumber

Usage example(s):

     self new
        packUint:16r12345678;
        contents

o  packUnsignedHyper: aLongNumber
self new
packUnsignedHyper:16r123456789abcdef0;
contents

o  packUnsignedInt: aNumber
self new
packUnsignedInt:16r12345678;
contents

packing - private
o  packFArray: aCollection using: selector
self new
packArray:#(1 2 3) using:#uint:;
contents

o  packFString: aString
}

packing-rpc packages
o  packAcceptedReply: hdr
procedure specific results...

o  packAuth: auth
AUTH_NULL

o  packAuthUnix: authUnix

o  packCallHeader: hdr

o  packDeniedReply: hdr
low supported version

o  packReplyHeader: hdr

queries
o  atEnd

unpacking
o  unpackArrayUsing: selector
|data|

data :=
XDRCoder new
packArray:#('a' 'b' 'c' 'd') using:#packString:;
contents.

(XDRCoder from:data) unpackArrayUsing:#unpackString

o  unpackBool
if proceeded, anything non-0 is treated as a true

Usage example(s):

     |data|

     data :=
        XDRCoder new
            packBool:true;
            contents.

     (XDRCoder from:data) unpackBool  

Usage example(s):

     |data|

     data :=
        XDRCoder new
            packBool:false;
            contents.

     (XDRCoder from:data) unpackBool  

o  unpackDouble
self error:'not yet implemented'.

Usage example(s):

     |data|

     data :=
        XDRCoder new
            packDouble:1.234;
            contents.

     (XDRCoder from:data) unpackDouble  

o  unpackEnum
self unpackUnsignedInt

Usage example(s):

     |data|

     data :=
        XDRCoder new
            packEnum:1234;
            contents.

     (XDRCoder from:data) unpackEnum  

o  unpackFloat
self error:'not yet implemented'.

Usage example(s):

     |data|

     data :=
        XDRCoder new
            packFloat:1.234;
            contents.

     (XDRCoder from:data) unpackFloat  

o  unpackHyper
|data|

data :=
XDRCoder new
packHyper:16r1234567890123456;
contents.

(XDRCoder from:data) unpackHyper hexPrintString

o  unpackInt
|data|

data :=
XDRCoder new
packInt:-1234;
contents.

(XDRCoder from:data) unpackInt

o  unpackListUsing: selectorOrBlock
|data|

data :=
XDRCoder new
packList:#('a' 'b' 'c' 'd') using:#packString:;
contents.

(XDRCoder from:data) unpackListUsing:#unpackString

o  unpackListUsing: selectorOrBlock with: aParameter

o  unpackOpaque
|data|

data :=
XDRCoder new
packString:'hello';
contents.

(XDRCoder from:data) unpackOpaque

o  unpackOpaqueBytes: nBytes
|data|

data :=
XDRCoder new
packString:'hello';
contents.

(XDRCoder from:data) unpackOpaque

o  unpackString
}

Usage example(s):

     |data|

     data :=
        XDRCoder new
            packString:'hello';
            contents.

     (XDRCoder from:data) unpackString    

o  unpackUhyper
^ self unpackUnsignedHyper

Usage example(s):

     |data|

     data :=
        XDRCoder new
            packUhyper:16r1234567890123456;
            contents.

     (XDRCoder from:data) unpackUhyper hexPrintString   

Usage example(s):

     |data|

     data :=
        XDRCoder new
            packUhyper:16rFEDCBA9876543210;
            contents.

     (XDRCoder from:data) unpackUhyper hexPrintString   

o  unpackUint
|data|

data :=
XDRCoder new
packUint:1234;
contents.

(XDRCoder from:data) unpackUint

o  unpackUnsignedHyper
|hi low|

Usage example(s):

     |data|

     data :=
        XDRCoder new
            packUnsignedHyper:16r1234567890123456;
            contents.

     (XDRCoder from:data) unpackUnsignedHyper hexPrintString   

o  unpackUnsignedInt
|data|

data :=
XDRCoder new
packUnsignedInt:1234;
contents.

(XDRCoder from:data) unpackUnsignedInt

unpacking-rpc packages
o  unpackAuth

o  unpackAuthUnixFrom: opaqueData

o  unpackCallHeader
should send a reply here

o  unpackReplyHeader



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 21 Dec 2024 15:55:07 GMT