Skip to content

Commit 788c62b

Browse files
committed
Add ppid parameter to sendmsg() and send_to().
1 parent 51f5106 commit 788c62b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ impl SctpStream {
8484

8585
/// Send bytes on the specified SCTP stream. On success, returns the
8686
/// quantity of bytes read
87-
pub fn sendmsg(&self, msg: &[u8], stream: u16) -> Result<usize> {
88-
return self.0.sendmsg::<SocketAddr>(msg, None, stream, 0);
87+
pub fn sendmsg(&self, msg: &[u8], ppid: u64, stream: u16) -> Result<usize> {
88+
return self.0.sendmsg::<SocketAddr>(msg, None, ppid, stream, 0);
8989
}
9090

9191
/// Read bytes. On success, return a tuple with the quantity of
@@ -233,8 +233,8 @@ impl SctpEndpoint {
233233

234234
/// Send data in Sctp style, to the provided address on the stream `stream`.
235235
/// On success, returns the quantity on bytes sent
236-
pub fn send_to<A: ToSocketAddrs>(&self, msg: &mut [u8], address: A, stream: u16) -> Result<usize> {
237-
return self.0.sendmsg(msg, Some(address), stream, 0);
236+
pub fn send_to<A: ToSocketAddrs>(&self, msg: &mut [u8], address: A, ppid: u64, stream: u16) -> Result<usize> {
237+
return self.0.sendmsg(msg, Some(address), ppid, stream, 0);
238238
}
239239

240240
/// Get local socket addresses to which this socket is bound

src/sctpsock.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ impl SctpSocket {
358358

359359
/// Send data in Sctp style, to the provided address (may be `None` if the socket is connected), on the stream `stream`, with the TTL `ttl`.
360360
/// On success, returns the quantity on bytes sent
361-
pub fn sendmsg<A: ToSocketAddrs>(&self, msg: &[u8], address: Option<A>, stream: u16, ttl: libc::c_ulong) -> Result<usize> {
361+
pub fn sendmsg<A: ToSocketAddrs>(&self, msg: &[u8], address: Option<A>, ppid: u64, stream: u16, ttl: libc::c_ulong) -> Result<usize> {
362362
let len = msg.len() as libc::size_t;
363363
let (raw_addr, addr_len) = match address {
364364
Some(a) => {
@@ -368,7 +368,7 @@ impl SctpSocket {
368368
None => (std::ptr::null_mut(), 0)
369369
};
370370
unsafe {
371-
return match sctp_sys::sctp_sendmsg(self.0, msg.as_ptr() as *const libc::c_void, len, raw_addr, addr_len, 0, 0, stream, ttl, 0) {
371+
return match sctp_sys::sctp_sendmsg(self.0, msg.as_ptr() as *const libc::c_void, len, raw_addr, addr_len, ppid, 0, stream, ttl, 0) {
372372
res if res > 0 => Ok(res as usize),
373373
_ => Err(Error::last_os_error())
374374
};

0 commit comments

Comments
 (0)