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

SCTP event subscribe uses pointer to pointer in the argument instead of just the pointer #6

Open
NAYANSEN90 opened this issue May 1, 2024 · 1 comment

Comments

@NAYANSEN90
Copy link

NAYANSEN90 commented May 1, 2024

Using the uintptr(unsafe.Pointer(&events)) in the SetEventSubscribe call.

@NAYANSEN90
Copy link
Author

NAYANSEN90 commented May 1, 2024

`func (listener *SCTPListener) SetEventSubscribe(events *SCTPEventSubscribe) error {
// here a local length variable is needed
_, _, err := syscall.Syscall6(
syscall.SYS_SETSOCKOPT,
uintptr(listener.sock),
SOL_SCTP,
SCTP_EVENTS,
uintptr(unsafe.Pointer(&events)), // this should be simply events
unsafe.Sizeof(*events),
0,
)
if 0 != err {
return err
}
return nil
}

func (listener *SCTPListener) GetEventSubscribe() (*SCTPEventSubscribe, error) {
var (
events = &SCTPEventSubscribe{}
length = unsafe.Sizeof(*events)
)
_, _, err := syscall.Syscall6(
syscall.SYS_GETSOCKOPT,
uintptr(listener.sock),
SOL_SCTP,
SCTP_EVENTS,
uintptr(unsafe.Pointer(events)),
uintptr(unsafe.Pointer(&length)),
0,
)
if 0 != err {
return nil, err
}
return events, nil
}`

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

No branches or pull requests

1 participant