-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connection-Oriented SCCP: CR & CC, to start with #29
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks for your contribution! Before merging, can you please;
- read through inline comments and fix them (including what golangci-lint claims).
- add GoDoc comments over every exported function.
- add test cases to sccp_test.go instead of adding _test files for each.
cc.go
Outdated
/* | ||
Message type 2.1 F 1 | ||
Destination local reference 3.2 F 3 | ||
Source local reference 3.3 F 3 | ||
Protocol class 3.6 F 1 | ||
Credit 3.10 O 3 | ||
Called party address 3.4 O 4 minimum | ||
Data 3.16 O 3-130 | ||
Importance 3.19 O 3 | ||
End of optional parameter 3.1 O 1 | ||
*/ | ||
type CC struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need such a detailed reference to the spec, and please follow the Go's convention of writing a comment as a doc (godoc). You can see udt.go
for reference.
CalledPartyAddress *params.PartyAddress | ||
} | ||
|
||
func ParseCC(b []byte) (*CC, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow the function order (see udt.go and scmg.go). Also, constructor (NewCC
) is missing.
return msg, nil | ||
} | ||
|
||
func (msg *CC) UnmarshalBinary(b []byte) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func (msg *CC) UnmarshalBinary(b []byte) error { | |
func (c *CC) UnmarshalBinary(b []byte) error { |
Please use a single character c
as a receiver, which is a convention of Go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
func (msg *CC) String() string { | ||
if msg.CalledPartyAddress != nil { | ||
return fmt.Sprintf("{Type: CC, CalledPartyAddress: %v}", msg.CalledPartyAddress) | ||
} | ||
return "{Type: CC}" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do similar to what UDT and SCMG do.
cc.go
Outdated
} | ||
|
||
func (msg *CC) MessageTypeName() string { | ||
return "CR" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return "CR" | |
return "CC" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -0,0 +1,34 @@ | |||
package params |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need a type definition for the local reference. Instead, you can define the source/destination local reference as uint32, and you can cut off the excessive octet (the easiest way is to use these utility functions).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
m = &CR{} | ||
case MsgTypeCC: | ||
m = &CC{} | ||
/* TODO: implement! case CREF: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* TODO: implement! case CREF: | |
/* TODO: implement! | |
case CREF: |
Opts []*params.Optional | ||
|
||
Data *params.Optional | ||
CalledPartyAddress *params.PartyAddress |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handling of the optional parameters could be nicer, but it's due to the bad-designed parameter handling in the current code base. I will work on refactoring parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, let me comment on this
In fact, for the practical case, I just need convenient access to Data and Called/Calling pty-s only.
To my knowledge, the only interface where connection-oriented SCCP is used, is GSM A-interface, and I can hardly imagine the real use of other params there.
I would appreciate to avoid making things complicated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q.713 is such a small spec and I'm more comfortable to just have everything implemented rather than to ignore some of them. I think I can quickly make it done soon-ish.
ok, thx |
I'd appreciate if you can try to get CC and CR merged first. I think it'd be less work for us both (to avoid reviewing everything at once with the same fixes that may apply to all messages). |
I have implemented all the params and XUDT as an example that has optional parameters. Please take a look at the latest master branch and continue your work :) |
No description provided.