jtux
Class UNetwork

java.lang.Object
  extended by jtux.UNetwork

public class UNetwork
extends java.lang.Object

Class for network system calls.

Not implemented:

                inet_addr, inet_ntoa: Replaced by inet_ntop and inet_pton.
                {set/get/end}{host/net/proto/serv}ent - To Do.
                gethostbyname, gethostbyaddr - replaced by getaddrinfo/getnameinfo.
                getnetbyname, getnetbyaddr - To Do
                getprotobyname, getprotobynumber- To Do
                getservbyname, getservbyport - To Do
                if_* - To Do
                getsockname, getpeername - To Do
                socketpair - To Do
                shutdown - To Do
                


Nested Class Summary
static class UNetwork.AddrInfoListHead
          Jtux-only -- non-standard.
static class UNetwork.s_addrinfo
          Java version of C struct addrinfo.
static class UNetwork.s_in_addr
          Java version of C struct in_addr.
static class UNetwork.s_in6_addr
          Java version of C struct in6_addr.
static class UNetwork.s_linger
          Java version of C struct linger.
static class UNetwork.s_msghdr
          Java version of C struct msghd.
static class UNetwork.s_sockaddr
          Java version of C struct sockaddr.
static class UNetwork.s_sockaddr_in
          Java version of C struct sockaddr_in.
static class UNetwork.s_sockaddr_in6
          Java version of C struct sockaddr_in6.
static class UNetwork.s_sockaddr_un
          Java version of C struct sockaddr_un.
static class UNetwork.SockOptValue
          Following class and its subclasses handle the value argument of setsockopt, which in C is of type "const void *".
static class UNetwork.SockOptValue_boolean
          Not necessary to use SockOptValue_boolean -- SockOptValue_int works just as well, as the UNIX system call doesn't know the difference.
static class UNetwork.SockOptValue_int
           
static class UNetwork.SockOptValue_s_linger
           
static class UNetwork.SockOptValue_s_timeval
           
 
Constructor Summary
UNetwork()
           
 
Method Summary
static int accept(int socket_fd, UNetwork.s_sockaddr sa, UUtil.IntHolder sa_len)
          Calls accept.
static void bind(int socket_fd, UNetwork.s_sockaddr sa, int sa_len)
          Calls bind.
static void connect(int socket_fd, UNetwork.s_sockaddr sa, int sa_len)
          Calls connect.
static void freeaddrinfo(UNetwork.s_addrinfo infop)
          Calls freeaddrinfo.
static java.lang.String gai_strerror(int code)
          Calls gai_strerror.
static void getaddrinfo(java.lang.String nodename, java.lang.String servname, UNetwork.s_addrinfo hint, UNetwork.AddrInfoListHead infop)
          Calls getaddrinfo.
static long gethostid()
          Calls gethostid.
static void gethostname(java.lang.StringBuffer name)
          Calls gethostname.
static void getnameinfo(UNetwork.s_sockaddr sa, int sa_len, java.lang.StringBuffer nodename, java.lang.StringBuffer servname, int flags)
          Calls getnameinfo.
static void getsockopt(int socket_fd, int level, int option, UNetwork.SockOptValue value, UUtil.IntHolder value_len)
          Calls getsockopt.
static int htonl(int hostnum)
          Calls htonl.
static short htons(short hostnum)
          Calls htons.
static java.lang.String inet_ntop(int domain, byte[] src)
          Calls inet_ntop.
static java.lang.String inet_ntop(int domain, int src)
          Calls inet_ntop.
static void inet_pton(int domain, java.lang.String src, byte[] dst)
          Calls inet_pton.
static void inet_pton(int domain, java.lang.String src, UUtil.IntHolder dst)
          Calls inet_pton.
static void listen(int socket_fd, int backlog)
          Calls listen.
static int ntohl(int netnum)
          Calls ntohl.
static short ntohs(short netnum)
          Calls ntohs.
static int recv(int socket_fd, byte[] buffer, int length, int flags)
          Calls recv.
static int recvfrom(int socket_fd, byte[] buffer, int length, int flags, UNetwork.s_sockaddr sa, UUtil.IntHolder sa_len)
          Calls recvfrom.
static int recvmsg(int socket_fd, UNetwork.s_msghdr message, int flags)
          Calls recvmsg.
static int send(int socket_fd, byte[] data, int length, int flags)
          Calls send.
static int sendmsg(int socket_fd, UNetwork.s_msghdr message, int flags)
          Calls sendmsg.
static int sendto(int socket_fd, byte[] message, int length, int flags, UNetwork.s_sockaddr sa, int sa_len)
          Calls sendto.
static void setsockopt(int socket_fd, int level, int option, UNetwork.SockOptValue value, int value_len)
          Calls setsockopt.
static int sockatmark(int socket_fd)
          Calls sockatmark.
static int socket(int domain, int type, int protocol)
          Calls socket.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UNetwork

public UNetwork()
Method Detail

accept

public static int accept(int socket_fd,
                         UNetwork.s_sockaddr sa,
                         UUtil.IntHolder sa_len)
                  throws UErrorException
Calls accept.

Click here for Posix/SUS C API.

Throws:
UErrorException

bind

public static void bind(int socket_fd,
                        UNetwork.s_sockaddr sa,
                        int sa_len)
                 throws UErrorException
Calls bind. Not necessary to set sa_len on input.

Click here for Posix/SUS C API.

Throws:
UErrorException

connect

public static void connect(int socket_fd,
                           UNetwork.s_sockaddr sa,
                           int sa_len)
                    throws UErrorException
Calls connect. Not necessary to set sa_len on input.

Click here for Posix/SUS C API.

Throws:
UErrorException

freeaddrinfo

public static void freeaddrinfo(UNetwork.s_addrinfo infop)
Calls freeaddrinfo.

Click here for Posix/SUS C API.


gai_strerror

public static java.lang.String gai_strerror(int code)
Calls gai_strerror.

Click here for Posix/SUS C API.


getaddrinfo

public static void getaddrinfo(java.lang.String nodename,
                               java.lang.String servname,
                               UNetwork.s_addrinfo hint,
                               UNetwork.AddrInfoListHead infop)
                        throws UErrorException
Calls getaddrinfo. (Replaces gethostbyname.)

Click here for Posix/SUS C API.

Throws:
UErrorException

gethostid

public static long gethostid()
Calls gethostid.

Click here for Posix/SUS C API.


gethostname

public static void gethostname(java.lang.StringBuffer name)
                        throws UErrorException
Calls gethostname.

Click here for Posix/SUS C API.

Throws:
UErrorException

getnameinfo

public static void getnameinfo(UNetwork.s_sockaddr sa,
                               int sa_len,
                               java.lang.StringBuffer nodename,
                               java.lang.StringBuffer servname,
                               int flags)
                        throws UErrorException
Calls getnameinfo. (Replaces gethostbyaddr.) sa_len not used.

Click here for Posix/SUS C API.

Throws:
UErrorException

getsockopt

public static void getsockopt(int socket_fd,
                              int level,
                              int option,
                              UNetwork.SockOptValue value,
                              UUtil.IntHolder value_len)
                       throws UErrorException
Calls getsockopt.

Click here for Posix/SUS C API.

Throws:
UErrorException

htonl

public static int htonl(int hostnum)
Calls htonl.

Click here for Posix/SUS C API.


htons

public static short htons(short hostnum)
Calls htons.

Click here for Posix/SUS C API.


inet_ntop

public static java.lang.String inet_ntop(int domain,
                                         int src)
                                  throws UErrorException
Calls inet_ntop.

Click here for Posix/SUS C API.

Throws:
UErrorException

inet_ntop

public static java.lang.String inet_ntop(int domain,
                                         byte[] src)
                                  throws UErrorException
Calls inet_ntop.

Click here for Posix/SUS C API.

Throws:
UErrorException

inet_pton

public static void inet_pton(int domain,
                             java.lang.String src,
                             UUtil.IntHolder dst)
                      throws UErrorException
Calls inet_pton.

Click here for Posix/SUS C API.

Throws:
UErrorException

inet_pton

public static void inet_pton(int domain,
                             java.lang.String src,
                             byte[] dst)
                      throws UErrorException
Calls inet_pton.

Click here for Posix/SUS C API.

Throws:
UErrorException

listen

public static void listen(int socket_fd,
                          int backlog)
                   throws UErrorException
Calls listen.

Click here for Posix/SUS C API.

Throws:
UErrorException

ntohl

public static int ntohl(int netnum)
Calls ntohl.

Click here for Posix/SUS C API.


ntohs

public static short ntohs(short netnum)
Calls ntohs.

Click here for Posix/SUS C API.


recv

public static int recv(int socket_fd,
                       byte[] buffer,
                       int length,
                       int flags)
                throws UErrorException
Calls recv.

Click here for Posix/SUS C API.

Throws:
UErrorException

recvfrom

public static int recvfrom(int socket_fd,
                           byte[] buffer,
                           int length,
                           int flags,
                           UNetwork.s_sockaddr sa,
                           UUtil.IntHolder sa_len)
                    throws UErrorException
Calls recvfrom. sa_len need not be set on input.

Click here for Posix/SUS C API.

Throws:
UErrorException

recvmsg

public static int recvmsg(int socket_fd,
                          UNetwork.s_msghdr message,
                          int flags)
                   throws UErrorException
Calls recvmsg.

Click here for Posix/SUS C API.

Throws:
UErrorException

send

public static int send(int socket_fd,
                       byte[] data,
                       int length,
                       int flags)
                throws UErrorException
Calls send.

Click here for Posix/SUS C API.

Throws:
UErrorException

sendmsg

public static int sendmsg(int socket_fd,
                          UNetwork.s_msghdr message,
                          int flags)
                   throws UErrorException
Calls sendmsg.

Click here for Posix/SUS C API.

Throws:
UErrorException

sendto

public static int sendto(int socket_fd,
                         byte[] message,
                         int length,
                         int flags,
                         UNetwork.s_sockaddr sa,
                         int sa_len)
                  throws UErrorException
Calls sendto. Not necessary to set sa_len on input.

Click here for Posix/SUS C API.

Throws:
UErrorException

setsockopt

public static void setsockopt(int socket_fd,
                              int level,
                              int option,
                              UNetwork.SockOptValue value,
                              int value_len)
                       throws UErrorException
Calls setsockopt.

Click here for Posix/SUS C API.

Throws:
UErrorException

sockatmark

public static int sockatmark(int socket_fd)
                      throws UErrorException
Calls sockatmark.

Click here for Posix/SUS C API.

Throws:
UErrorException

socket

public static int socket(int domain,
                         int type,
                         int protocol)
                  throws UErrorException
Calls socket.

Click here for Posix/SUS C API.

Throws:
UErrorException