Package org.opennms.jicmp.jna
Class BSDV4NativeSocket
- java.lang.Object
-
- org.opennms.jicmp.jna.NativeDatagramSocket
-
- org.opennms.jicmp.jna.BSDV4NativeSocket
-
- All Implemented Interfaces:
AutoCloseable
public class BSDV4NativeSocket extends NativeDatagramSocket
UnixNativeSocketFactory- Author:
- brozow
-
-
Field Summary
-
Fields inherited from class org.opennms.jicmp.jna.NativeDatagramSocket
AF_INET, AF_INET6, IP_MTU_DISCOVER, IPPROTO_ICMP, IPPROTO_ICMPV6, IPPROTO_IP, IPPROTO_IPV6, IPPROTO_UDP, IPV6_DONTFRAG, PF_INET, PF_INET6, SOCK_DGRAM, SOCK_RAW
-
-
Constructor Summary
Constructors Constructor Description BSDV4NativeSocket(int family, int type, int protocol, int listenPort)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
allowFragmentation(boolean frag)
int
bind(int socket, bsd_sockaddr_in address, int address_len)
void
close()
int
close(int socket)
int
getSock()
int
receive(NativeDatagramPacket p)
int
recvfrom(int socket, Buffer buffer, int buflen, int flags, bsd_sockaddr_in in_addr, int[] in_addr_len)
int
send(NativeDatagramPacket p)
int
sendto(int socket, Buffer buffer, int buflen, int flags, bsd_sockaddr_in dest_addr, int dest_addr_len)
int
setsockopt(int socket, int level, int option_name, com.sun.jna.Pointer value, int option_len)
void
setTrafficClass(int tc)
int
socket(int domain, int type, int protocol)
-
Methods inherited from class org.opennms.jicmp.jna.NativeDatagramSocket
allowFragmentation, create, strerror
-
-
-
-
Method Detail
-
bind
public int bind(int socket, bsd_sockaddr_in address, int address_len) throws com.sun.jna.LastErrorException
- Throws:
com.sun.jna.LastErrorException
-
socket
public int socket(int domain, int type, int protocol) throws com.sun.jna.LastErrorException
- Throws:
com.sun.jna.LastErrorException
-
setsockopt
public int setsockopt(int socket, int level, int option_name, com.sun.jna.Pointer value, int option_len)
- Overrides:
setsockopt
in classNativeDatagramSocket
-
sendto
public int sendto(int socket, Buffer buffer, int buflen, int flags, bsd_sockaddr_in dest_addr, int dest_addr_len) throws com.sun.jna.LastErrorException
- Throws:
com.sun.jna.LastErrorException
-
recvfrom
public int recvfrom(int socket, Buffer buffer, int buflen, int flags, bsd_sockaddr_in in_addr, int[] in_addr_len) throws com.sun.jna.LastErrorException
- Throws:
com.sun.jna.LastErrorException
-
close
public int close(int socket) throws com.sun.jna.LastErrorException
- Throws:
com.sun.jna.LastErrorException
-
setTrafficClass
public void setTrafficClass(int tc) throws IOException
- Specified by:
setTrafficClass
in classNativeDatagramSocket
- Throws:
IOException
-
allowFragmentation
public void allowFragmentation(boolean frag) throws IOException
- Specified by:
allowFragmentation
in classNativeDatagramSocket
- Throws:
IOException
-
receive
public int receive(NativeDatagramPacket p)
- Specified by:
receive
in classNativeDatagramSocket
-
send
public int send(NativeDatagramPacket p)
- Specified by:
send
in classNativeDatagramSocket
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in classNativeDatagramSocket
-
getSock
public int getSock()
- Specified by:
getSock
in classNativeDatagramSocket
-
-