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

Size of next incoming message (upcall handler) #4

Open
lgrahl opened this issue Jan 22, 2017 · 3 comments
Open

Size of next incoming message (upcall handler) #4

lgrahl opened this issue Jan 22, 2017 · 3 comments
Assignees

Comments

@lgrahl
Copy link

lgrahl commented Jan 22, 2017

When using the upcall handler, we need to use usrsctp_recvv to retrieve the next message once the SCTP_EVENT_READ has been raised. In order to optimise memory allocation, can we get a function that returns the size of the message we would receive in the next usrsctp_recvv call?

Something like this:

size_t usrsctp_next_message_size(
    struct socket *so,
    struct sockaddr *from,
    socklen_t fromlen,
    int msg_flags
);
@tuexen tuexen self-assigned this Jan 24, 2017
@tuexen
Copy link
Collaborator

tuexen commented Jan 24, 2017

I thought about add a socket option using IPPROTO_SCTP as its level and SCTP_GET_NXT_INFO as its name and using

struct sctp_nxtinfo {
    uint16_t nxt_sid;
    uint16_t nxt_flags;
    uint32_t nxt_ppid;
    uint32_t nxt_length;
    sctp_assoc_t nxt_assoc_id;
};

as its value, which is already defined in RFC6458. This could only be used with getsockopt().
The only thing I'm not sure about is how to handle the case where no next message is queued. Returning -1 from getsockopt() and setting errno to EAGAIN is something I want to avoid. So I think it might be good to define a constant SCTP_NO_MESSAGE which is used in nxt_flags. Any opinion on that?

@lgrahl
Copy link
Author

lgrahl commented Jan 24, 2017

Fine by me. I agree that getsockopt should not return -1 in case no message is available.

@lgrahl
Copy link
Author

lgrahl commented Jan 12, 2018

It has been a year now. :) Any update?

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

No branches or pull requests

2 participants