#6730: fix ip encoding endianness + move timespec to ffi
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
parent
80d2cee238
commit
ab16e625e0
|
@ -323,13 +323,6 @@ public interface LibQuiche extends Library
|
||||||
public timespec at;
|
public timespec at;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Structure.FieldOrder({"tv_sec", "tv_nsec"})
|
|
||||||
class timespec extends Structure
|
|
||||||
{
|
|
||||||
public uint64_t tv_sec;
|
|
||||||
public long tv_nsec;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Writes a single QUIC packet to be sent to the peer.
|
// Writes a single QUIC packet to be sent to the peer.
|
||||||
ssize_t quiche_conn_send(quiche_conn conn, ByteBuffer out, size_t out_len, quiche_send_info out_info);
|
ssize_t quiche_conn_send(quiche_conn conn, ByteBuffer out, size_t out_len, quiche_send_info out_info);
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ import java.net.InetAddress;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.ByteOrder;
|
||||||
|
|
||||||
import com.sun.jna.Pointer;
|
import com.sun.jna.Pointer;
|
||||||
import com.sun.jna.Structure;
|
import com.sun.jna.Structure;
|
||||||
|
@ -37,7 +38,7 @@ public interface netinet_h
|
||||||
|
|
||||||
sockaddr_in sa = new sockaddr_in();
|
sockaddr_in sa = new sockaddr_in();
|
||||||
sa.sin_family = AF_INET;
|
sa.sin_family = AF_INET;
|
||||||
sa.sin_addr = new uint32_t(ByteBuffer.wrap(address.getAddress()).getInt()); // TODO: is the endianness correct?
|
sa.sin_addr = new uint32_t(ByteBuffer.wrap(address.getAddress()).order(ByteOrder.nativeOrder()).getInt());
|
||||||
sa.sin_port = new uint16_t(inetSocketAddress.getPort());
|
sa.sin_port = new uint16_t(inetSocketAddress.getPort());
|
||||||
return sa;
|
return sa;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
//
|
||||||
|
// ========================================================================
|
||||||
|
// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others.
|
||||||
|
//
|
||||||
|
// This program and the accompanying materials are made available under the
|
||||||
|
// terms of the Eclipse Public License v. 2.0 which is available at
|
||||||
|
// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
|
||||||
|
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
|
||||||
|
// ========================================================================
|
||||||
|
//
|
||||||
|
|
||||||
|
package org.eclipse.jetty.quic.quiche.ffi;
|
||||||
|
|
||||||
|
import com.sun.jna.Structure;
|
||||||
|
|
||||||
|
@Structure.FieldOrder({"tv_sec", "tv_nsec"})
|
||||||
|
public class timespec extends Structure
|
||||||
|
{
|
||||||
|
public uint64_t tv_sec;
|
||||||
|
public long tv_nsec;
|
||||||
|
}
|
Loading…
Reference in New Issue