|
Class: XDRCoder (in SunRPC)
Object
|
+--SunRPC::XDRCoder
- Package:
- stx:goodies/communication
- Category:
- Net-Communication-SunRPC
- Version:
- rev:
1.24
date: 2018/01/19 22:53:24
- user: cg
- file: SunRPC_XDRCoder.st directory: goodies/communication
- module: stx stc-classLibrary: communication
- Author:
- Claus Gittinger
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)
http://tools.ietf.org/html/rfc4506
instance creation
-
from: data
-
-
new
-
accessing
-
contents
-
return the data buffered so far
usage example(s):
(self new
uint:16r12345678;
contents) printOn:Transcript base:16
|
decoding
-
decodeArrayWithType: arrayType
-
-
decodeBoolean
-
-
decodeChar
-
-
decodeInt
-
-
decodeLong
-
-
decodeOpaqueWithType: stringType
-
fixed size
-
decodeOptionalWithType: optionalType
-
-
decodeShort
-
-
decodeStringWithType: stringType
-
fixed size
-
decodeStructWithType: structType
-
-
decodeStructWithType: structType ignoreLast: ignoreLast
-
-
decodeUnionWithType: unionType
-
must be enum then
-
decodeUnsignedChar
-
-
decodeUnsignedInt
-
-
decodeUnsignedLong
-
-
decodeUnsignedShort
-
encoding
-
decodeEnumWithType: enumType
-
-
encodeArray: anArray type: arrayType with: aParameter
-
-
encodeBoolean: value with: aParameter
-
-
encodeChar: value with: aParameter
-
-
encodeEnum: value type: enumType with: aParameter
-
-
encodeInt: value with: aParameter
-
-
encodeLong: value with: aParameter
-
-
encodeOpaque: value type: opaqueType with: dummyParameter
-
fixed size
-
encodeOptional: value type: optionalType with: dummyParameter
-
-
encodeShort: value with: aParameter
-
-
encodeString: value type: stringType with: dummyParameter
-
fixed size
-
encodeStruct: value type: structType with: dummyParameter
-
-
encodeStruct: value type: structType with: dummyParameter ignoreLast: ignoreLast
-
-
encodeUnion: value type: unionType with: dummyParameter
-
must be enum then
-
encodeUnsignedChar: value with: aParameter
-
-
encodeUnsignedInt: value with: aParameter
-
-
encodeUnsignedLong: value with: aParameter
-
-
encodeUnsignedShort: value with: aParameter
-
-
encodeVoid: value with: aParameter
-
nothing encoded for void
initialization
-
initialize
-
-
initializeFor: data
-
packing
-
packArray: aCollection using: selector
-
self new
packArray:#(1 2 3) using:#uint:;
contents
-
packBool: aBool
-
self new
packBool:true;
contents
-
packDouble: aFloat
-
self new
packDouble:1.2345;
contents
-
packEnum: aNumberOrSymbol
-
-
packFloat: aFloat
-
self new
packFloat:1.2345;
contents
-
packHyper: aNumber
-
self new
packHyper:-1;
contents
-
packInt: aNumber
-
self new
packInt:-1;
contents
-
packList: aCollection using: selectorOrBlock
-
self new
packList:#(1 2 3) using:#packUint:;
contents
-
packList: aCollection using: selectorOrBlock with: aParameter
-
-
packOpaque: something
-
self new
packOpaque:'abcdefg';
contents
-
packString: aString
-
self new
packString:'abcdefg';
contents
-
packUhyper: aLongNumber
-
self packUnsignedHyper:aLongNumber.
usage example(s):
self new
packUhyper:16r123456789abcdef0;
contents
|
-
packUint: aNumber
-
self packUnsignedInt:aNumber
usage example(s):
self new
packUint:16r12345678;
contents
|
-
packUnsignedHyper: aLongNumber
-
self new
packUnsignedHyper:16r123456789abcdef0;
contents
-
packUnsignedInt: aNumber
-
self new
packUnsignedInt:16r12345678;
contents
packing - private
-
packFArray: aCollection using: selector
-
self new
packArray:#(1 2 3) using:#uint:;
contents
-
packFString: aString
-
}
packing-rpc packages
-
packAcceptedReply: hdr
-
procedure specific results...
-
packAuth: auth
-
AUTH_NULL
-
packAuthUnix: authUnix
-
-
packCallHeader: hdr
-
-
packDeniedReply: hdr
-
low supported version
-
packReplyHeader: hdr
-
queries
-
atEnd
-
unpacking
-
unpackArrayUsing: selector
-
|data|
data :=
XDRCoder new
packArray:#('a' 'b' 'c' 'd') using:#packString:;
contents.
(XDRCoder from:data) unpackArrayUsing:#unpackString
-
unpackBool
-
if proceeded, anything non-0 is treated as a true
-
unpackDouble
-
self error:'not yet implemented'.
-
unpackEnum
-
self unpackUnsignedInt
-
unpackFloat
-
self error:'not yet implemented'.
-
unpackHyper
-
|data|
data :=
XDRCoder new
packHyper:16r1234567890123456;
contents.
(XDRCoder from:data) unpackHyper hexPrintString
-
unpackInt
-
|data|
data :=
XDRCoder new
packInt:-1234;
contents.
(XDRCoder from:data) unpackInt
-
unpackListUsing: selectorOrBlock
-
|data|
data :=
XDRCoder new
packList:#('a' 'b' 'c' 'd') using:#packString:;
contents.
(XDRCoder from:data) unpackListUsing:#unpackString
-
unpackListUsing: selectorOrBlock with: aParameter
-
-
unpackOpaque
-
|data|
data :=
XDRCoder new
packString:'hello';
contents.
(XDRCoder from:data) unpackOpaque
-
unpackOpaqueBytes: nBytes
-
|data|
data :=
XDRCoder new
packString:'hello';
contents.
(XDRCoder from:data) unpackOpaque
-
unpackString
-
}
-
unpackUhyper
-
^ self unpackUnsignedHyper
-
unpackUint
-
|data|
data :=
XDRCoder new
packUint:1234;
contents.
(XDRCoder from:data) unpackUint
-
unpackUnsignedHyper
-
|hi low|
-
unpackUnsignedInt
-
|data|
data :=
XDRCoder new
packUnsignedInt:1234;
contents.
(XDRCoder from:data) unpackUnsignedInt
unpacking-rpc packages
-
unpackAuth
-
-
unpackAuthUnixFrom: opaqueData
-
-
unpackCallHeader
-
should send a reply here
-
unpackReplyHeader
-
|