/[classpath]/classpath/native/jni/java-net/java_net_InetAddress.c
ViewVC logotype

Diff of /classpath/native/jni/java-net/java_net_InetAddress.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by egagnon, Mon Mar 29 07:07:39 2004 UTC revision 1.9.2.1 by gnu_andrew, Sat Jan 15 17:02:22 2005 UTC
# Line 61  exception statement from your version. * Line 61  exception statement from your version. *
61   * Function to return the local hostname   * Function to return the local hostname
62   */   */
63  JNIEXPORT jstring JNICALL  JNIEXPORT jstring JNICALL
64  Java_java_net_InetAddress_getLocalHostname(JNIEnv *env, jclass class)  Java_java_net_InetAddress_getLocalHostname(JNIEnv *env,
65                                               jclass class
66                                               __attribute__ ((__unused__)))
67  {  {
68    char    hostname[256];    char    hostname[256];
69    int     result;    int     result;
# Line 91  Java_java_net_InetAddress_getLocalHostna Line 93  Java_java_net_InetAddress_getLocalHostna
93   * Returns the value of the special IP address INADDR_ANY   * Returns the value of the special IP address INADDR_ANY
94   */   */
95  JNIEXPORT jarray JNICALL  JNIEXPORT jarray JNICALL
96  Java_java_net_InetAddress_lookupInaddrAny(JNIEnv *env, jclass class)  Java_java_net_InetAddress_lookupInaddrAny(JNIEnv *env,
97                                              jclass class
98                                              __attribute__ ((__unused__)))
99  {  {
100    jarray IParray;    jarray IParray;
101    jbyte  *octets;    jbyte  *octets;
# Line 135  Java_java_net_InetAddress_lookupInaddrAn Line 139  Java_java_net_InetAddress_lookupInaddrAn
139   * in as a byte array   * in as a byte array
140   */   */
141  JNIEXPORT jstring JNICALL  JNIEXPORT jstring JNICALL
142  Java_java_net_InetAddress_getHostByAddr(JNIEnv *env, jclass class, jarray arr)  Java_java_net_InetAddress_getHostByAddr(JNIEnv *env,
143                                            jclass class
144                                            __attribute__ ((__unused__)),
145                                            jarray arr)
146  {  {
147  #ifndef WITHOUT_NETWORK  #ifndef WITHOUT_NETWORK
148    jbyte   *octets;    jbyte   *octets;
# Line 193  Java_java_net_InetAddress_getHostByAddr( Line 200  Java_java_net_InetAddress_getHostByAddr(
200  /*************************************************************************/  /*************************************************************************/
201    
202  JNIEXPORT jobjectArray JNICALL  JNIEXPORT jobjectArray JNICALL
203  Java_java_net_InetAddress_getHostByName(JNIEnv *env, jclass class, jstring host)  Java_java_net_InetAddress_getHostByName(JNIEnv *env,
204                                            jclass class
205                                            __attribute__ ((__unused__)),
206                                            jstring host)
207  {  {
208  #ifndef WITHOUT_NETWORK  #ifndef WITHOUT_NETWORK
209    const char     *hostname;    const char     *hostname;
# Line 206  Java_java_net_InetAddress_getHostByName( Line 216  Java_java_net_InetAddress_getHostByName(
216    int            i;    int            i;
217    jbyte          *octets;    jbyte          *octets;
218    jarray         ret_octets;    jarray         ret_octets;
219      int            max_addresses;
220    
221    assert(env!=NULL);    assert(env!=NULL);
222    assert((*env)!=NULL);    assert((*env)!=NULL);
# Line 218  Java_java_net_InetAddress_getHostByName( Line 229  Java_java_net_InetAddress_getHostByName(
229        return (jobjectArray)NULL;        return (jobjectArray)NULL;
230      }      }
231    
232    /* Look up the host */    max_addresses = sizeof(addresses) / sizeof(addresses[0]);
233    TARGET_NATIVE_NETWORK_GET_HOSTNAME_BY_NAME(hostname,    TARGET_NATIVE_NETWORK_GET_HOSTNAME_BY_NAME(hostname,
234                                               addresses,                                               addresses,
235                                               sizeof(addresses)/sizeof(addresses[0]),                                               max_addresses,
236                                               addresses_count,                                               addresses_count,
237                                               result                                               result);
                                             );  
238    if (result != TARGET_NATIVE_OK)    if (result != TARGET_NATIVE_OK)
239      {      {
240        JCL_ThrowException(env, UNKNOWN_HOST_EXCEPTION, (char*)hostname);        JCL_ThrowException(env, UNKNOWN_HOST_EXCEPTION, (char*)hostname);

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.9.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26