aboutsummaryrefslogtreecommitdiff
path: root/parse
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-10-09 19:41:46 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-10-09 19:41:46 +0200
commit3479b3dbacceeb2fdc7591bdb150c10e31299ba4 (patch)
tree8ed0cb7990755c0eda55f4fd07ad189f7ae30dcc /parse
parent5da3820c360e34ef8e7c6b4757783e9514f72f71 (diff)
First real communication
Diffstat (limited to 'parse')
-rw-r--r--parse/packets.go18
-rw-r--r--parse/parse.go37
2 files changed, 43 insertions, 12 deletions
diff --git a/parse/packets.go b/parse/packets.go
index 917ae19..80e6f67 100644
--- a/parse/packets.go
+++ b/parse/packets.go
@@ -182,6 +182,24 @@ var session = [][]byte{
0x08, 0x30, 0x06, 0x81, 0x04, 0x01, 0x31, 0x00,
0x01,
},
+ { // AARQ
+ 0x61, 0x2F, 0x80, 0x02, 0x07, 0x80, 0xA1, 0x07,
+ 0x06, 0x05, 0x2B, 0x0C, 0x00, 0x81, 0x5A, 0xA2,
+ 0x03, 0x02, 0x01, 0x00, 0xA3, 0x05, 0xA1, 0x03,
+ 0x02, 0x01, 0x01, 0xBE, 0x14, 0x28, 0x12, 0x06,
+ 0x07, 0x2B, 0x0C, 0x00, 0x82, 0x1D, 0x81, 0x48,
+ 0xA0, 0x07, 0xA0, 0x05, 0x03, 0x03, 0x00, 0x08,
+ 0x00,
+ },
+ { // AARE
+ 0x61, 0x19, 0x80, 0x02, 0x07, 0x80, 0xA1, 0x07,
+ 0x06, 0x05, 0x2B, 0x0C, 0x00, 0x81, 0x5A, 0xA2,
+ 0x03, 0x02, 0x01, 0x01, 0xA3, 0x05, 0xA1, 0x03,
+ 0x02, 0x01, 0x01,
+ },
+ { // ABRT
+ 0x64, 0x03, 0x80, 0x01, 0x00,
+ },
}
var (
diff --git a/parse/parse.go b/parse/parse.go
index f128440..3d74e58 100644
--- a/parse/parse.go
+++ b/parse/parse.go
@@ -37,30 +37,43 @@ func main() {
//fmt.Println(ber.Dump(s))
switch s[0] {
case 0xa1:
- v := &rose.Invoke{}
- unmarshal(s, v)
- if v.Opcode == 211 {
+ id, opcode, buf, err := rose.Unmarshal(s)
+ if err != nil {
+ fmt.Println(err)
+ }
+ if opcode == csta.SystemStatusOpcode {
ss := &csta.SystemStatusArg{}
- unmarshal(v.RawValue.FullBytes, ss)
- fmt.Println(ss.SystemStatus)
+ asn1.Unmarshal(buf, ss)
+ fmt.Println("Status", ss.SystemStatus)
+ null, _ := asn1.Marshal(asn1.Null{})
+ res, err := rose.Marshal(id, opcode, null)
+ if err != nil {
+ fmt.Println(err)
+ }
+ fmt.Printf("%x\n", s)
+ fmt.Printf("%x\n", res)
+ } else {
+ unmarshal(s, &rose.Invoke{})
}
case 0xa2:
- v := &rose.ReturnResult{}
- unmarshal(s, v)
- if v.Result.Opcode == 211 {
- ss := &csta.SystemStatusRes{}
- unmarshal(v.Result.RawValue.FullBytes, ss)
- }
+ unmarshal(s, &rose.ReturnResult{})
case 0x60:
unmarshal(s, &acse.AARQ{})
+ a, _ := acse.Associate()
+ fmt.Printf("%x\n", s)
+ fmt.Printf("%x\n", a)
case 0x61:
unmarshal(s, &acse.AARE{})
+ reason, _ := acse.AssociateResult(s)
+ fmt.Println("Reason", reason)
case 0x62:
unmarshal(s, &acse.RLRQ{})
case 0x63:
unmarshal(s, &acse.RLRE{})
case 0x64:
- unmarshal(s, &acse.ABRT{})
+ a := &acse.ABRT{}
+ unmarshal(s, a)
+ fmt.Println(a)
}
}