|
Class: XDRCoder (in SunRPC)
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
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)
copyrightCOPYRIGHT (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.
instance creation
-
from: data
-
-
new
-
(comment from inherited method)
return an instance of myself without indexed variables
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
-
(comment from inherited method)
just to ignore initialize to objects which do not need it
-
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
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
|
-
unpackDouble
-
self error:'not yet implemented'.
Usage example(s):
|data|
data :=
XDRCoder new
packDouble:1.234;
contents.
(XDRCoder from:data) unpackDouble
|
-
unpackEnum
-
self unpackUnsignedInt
Usage example(s):
|data|
data :=
XDRCoder new
packEnum:1234;
contents.
(XDRCoder from:data) unpackEnum
|
-
unpackFloat
-
self error:'not yet implemented'.
Usage example(s):
|data|
data :=
XDRCoder new
packFloat:1.234;
contents.
(XDRCoder from:data) unpackFloat
|
-
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
-
}
Usage example(s):
|data|
data :=
XDRCoder new
packString:'hello';
contents.
(XDRCoder from:data) unpackString
|
-
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
|
-
unpackUint
-
|data|
data :=
XDRCoder new
packUint:1234;
contents.
(XDRCoder from:data) unpackUint
-
unpackUnsignedHyper
-
|hi low|
Usage example(s):
|data|
data :=
XDRCoder new
packUnsignedHyper:16r1234567890123456;
contents.
(XDRCoder from:data) unpackUnsignedHyper hexPrintString
|
-
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
-
|