Move toMessage into Object and use writeOn: aMsg in all classes.
This commit is contained in:
parent
fcb0c30b42
commit
5a0b30953b
|
@ -10,6 +10,15 @@ Integer extend [
|
|||
]
|
||||
]
|
||||
|
||||
Object extend [
|
||||
toMessage [
|
||||
| msg |
|
||||
msg := Osmo.MessageBuffer new.
|
||||
self writeOn: msg.
|
||||
^ msg
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
"Code from FileDescriptor, GST license"
|
||||
Sockets.Socket extend [
|
||||
|
|
63
SCCP.st
63
SCCP.st
|
@ -122,29 +122,28 @@ SCCPMessage subclass: SCCPConnectionRequest [
|
|||
data := aData.
|
||||
]
|
||||
|
||||
toMessage [
|
||||
writeOn: aMsg [
|
||||
<category: 'conversion'>
|
||||
| msg len addr |
|
||||
| len addr |
|
||||
|
||||
addr := dst asByteArray.
|
||||
|
||||
msg := MessageBuffer new.
|
||||
msg putByte: SCCPHelper msgCr.
|
||||
SCCPAddrReference store: src on: msg.
|
||||
aMsg putByte: SCCPHelper msgCr.
|
||||
SCCPAddrReference store: src on: aMsg.
|
||||
"store proto_class, variable_called, optional_start"
|
||||
msg putByte: 2.
|
||||
msg putByte: 2.
|
||||
msg putByte: 1 + addr size.
|
||||
aMsg putByte: 2.
|
||||
aMsg putByte: 2.
|
||||
aMsg putByte: 1 + addr size.
|
||||
|
||||
msg putByteArray: addr.
|
||||
aMsg putByteArray: addr.
|
||||
|
||||
" place the data now "
|
||||
msg putByte: SCCPHelper pncData.
|
||||
msg putByte: data size.
|
||||
msg putByteArray: data.
|
||||
msg putByte: SCCPHelper pncEoO.
|
||||
aMsg putByte: SCCPHelper pncData.
|
||||
aMsg putByte: data size.
|
||||
aMsg putByteArray: data.
|
||||
aMsg putByte: SCCPHelper pncEoO.
|
||||
|
||||
^ msg.
|
||||
^ aMsg.
|
||||
]
|
||||
]
|
||||
|
||||
|
@ -187,19 +186,17 @@ SCCPMessage subclass: SCCPConnectionReleased [
|
|||
yourself
|
||||
]
|
||||
|
||||
toMessage [
|
||||
writeOn: aMsg [
|
||||
<category: 'conversion'>
|
||||
| msg |
|
||||
|
||||
msg := MessageBuffer new.
|
||||
msg putByte: SCCPHelper msgRlsd.
|
||||
SCCPAddrReference store: dst on: msg.
|
||||
SCCPAddrReference store: src on: msg.
|
||||
msg putByte: cause.
|
||||
msg putByte: 1.
|
||||
msg putByte: SCCPHelper pncEoO.
|
||||
aMsg putByte: SCCPHelper msgRlsd.
|
||||
SCCPAddrReference store: dst on: aMsg.
|
||||
SCCPAddrReference store: src on: aMsg.
|
||||
aMsg putByte: cause.
|
||||
aMsg putByte: 1.
|
||||
aMsg putByte: SCCPHelper pncEoO.
|
||||
|
||||
^ msg.
|
||||
^ aMsg.
|
||||
]
|
||||
|
||||
|
||||
|
@ -240,18 +237,16 @@ SCCPMessage subclass: SCCPConnectionData [
|
|||
].
|
||||
]
|
||||
|
||||
toMessage [
|
||||
writeOn: aMsg [
|
||||
<category: 'conversion'>
|
||||
| msg |
|
||||
|
||||
msg := MessageBuffer new.
|
||||
msg putByte: SCCPHelper msgDt1.
|
||||
SCCPAddrReference store: dst on: msg.
|
||||
msg putByte: 0.
|
||||
msg putByte: 1.
|
||||
msg putByte: data size.
|
||||
msg putByteArray: data.
|
||||
aMsg putByte: SCCPHelper msgDt1.
|
||||
SCCPAddrReference store: dst on: aMsg.
|
||||
aMsg putByte: 0.
|
||||
aMsg putByte: 1.
|
||||
aMsg putByte: data size.
|
||||
aMsg putByteArray: data.
|
||||
|
||||
^ msg
|
||||
^ aMsg
|
||||
]
|
||||
]
|
||||
|
|
Reference in New Issue