Skip to content
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

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

dmisol
Copy link

@dmisol dmisol commented Dec 26, 2024

No description provided.

Copy link
Owner

@wmnsk wmnsk left a 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
Comment on lines 10 to 21
/*
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 {
Copy link
Owner

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) {
Copy link
Owner

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 {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines +161 to +166
func (msg *CC) String() string {
if msg.CalledPartyAddress != nil {
return fmt.Sprintf("{Type: CC, CalledPartyAddress: %v}", msg.CalledPartyAddress)
}
return "{Type: CC}"
}
Copy link
Owner

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"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return "CR"
return "CC"

Copy link
Author

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
Copy link
Owner

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).

Copy link
Author

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:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/* TODO: implement! case CREF:
/* TODO: implement!
case CREF:

Comment on lines +27 to +30
Opts []*params.Optional

Data *params.Optional
CalledPartyAddress *params.PartyAddress
Copy link
Owner

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.

Copy link
Author

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

Copy link
Owner

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.

@dmisol
Copy link
Author

dmisol commented Dec 28, 2024

ok, thx
will match your requirements after all conn-oriented SCCP finished on our side.
will revert in a while

@wmnsk
Copy link
Owner

wmnsk commented Dec 29, 2024

will match your requirements after all conn-oriented SCCP finished on our side.

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).

@wmnsk
Copy link
Owner

wmnsk commented Jan 4, 2025

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants