/[classpath]/classpath/native/target/generic/target_generic_network.h
ViewVC logotype

Diff of /classpath/native/target/generic/target_generic_network.h

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

revision 1.5 by rupp, Tue Jul 15 14:32:03 2003 UTC revision 1.6 by rupp, Tue Jul 22 16:19:17 2003 UTC
# Line 804  extern "C" { Line 804  extern "C" {
804  #endif  #endif
805    
806  /***********************************************************************\  /***********************************************************************\
 * Name       : TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_SO_TIMEOUT  
 * Purpose    : set socket option SO_TIMEOUT  
 * Input      : socketDescriptor - socket descriptor  
 *              value            - value  
 * Output     : result - TARGET_NATIVE_OK if no error occurred,  
 *                       TARGET_NATIVE_ERROR otherwise  
 * Return     : -  
 * Side-effect: unknown  
 * Notes      : -  
 \***********************************************************************/  
   
 #ifndef TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_SO_TIMEOUT  
   #include <sys/types.h>  
   #include <sys/socket.h>  
   #include <netinet/in.h>  
   #define TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_SO_TIMEOUT(socketDescriptor,value,result) \  
     do { \  
       int __value; \  
       \  
       __value=value; \  
       result=(setsockopt(socketDescriptor,SOL_SOCKET,SO_TIMEOUT,&__value,sizeof(__value))==0)?TARGET_NATIVE_OK:TARGET_NATIVE_ERROR; \  
     } while (0)  
 #endif  
   
 /***********************************************************************\  
807  * Name       : TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_ADD_MEMBERSHIP  * Name       : TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_ADD_MEMBERSHIP
808  * Purpose    : set socket option IP_ADD_MEMBERSHIP  * Purpose    : set socket option IP_ADD_MEMBERSHIP
809  * Input      : socketDescriptor - socket descriptor  * Input      : socketDescriptor - socket descriptor
# Line 908  extern "C" { Line 883  extern "C" {
883  #endif  #endif
884    
885  /***********************************************************************\  /***********************************************************************\
886    * Name       : TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_BROADCAST
887    * Purpose    : set socket option SO_BROADCAST
888    * Input      : socketDescriptor - socket descriptor
889    *              flag             - 1 or 0
890    * Output     : result - TARGET_NATIVE_OK if no error occurred,
891    *                       TARGET_NATIVE_ERROR otherwise
892    * Return     : -
893    * Side-effect: unknown
894    * Notes      : -
895    \***********************************************************************/
896    
897    #ifndef TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_BROADCAST
898      #include <sys/types.h>
899      #include <sys/socket.h>
900      #include <netinet/tcp.h>
901      #define TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_BROADCAST(socketDescriptor,flag,result) \
902        do { \
903          int __value; \
904          \
905          __value=flag; \
906          result=(setsockopt(socketDescriptor,SOL_SOCKET,SO_BROADCAST,&__value,sizeof(__value))==0)?TARGET_NATIVE_OK:TARGET_NATIVE_ERROR; \
907        } while (0)
908    #endif
909    
910    /*---------------------------------------------------------------------*/
911    
912    /***********************************************************************\
913  * Name       : TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_TCP_NODELAY  * Name       : TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_TCP_NODELAY
914  * Purpose    : get socket option TCP_NODELAY  * Purpose    : get socket option TCP_NODELAY
915  * Input      : socketDescriptor - socket descriptor  * Input      : socketDescriptor - socket descriptor
# Line 1235  extern "C" { Line 1237  extern "C" {
1237        if (result==TARGET_NATIVE_OK) \        if (result==TARGET_NATIVE_OK) \
1238        { \        { \
1239          assert(__len>=sizeof(__value)); \          assert(__len>=sizeof(__value)); \
1240            flag=__value; \
1241          } \
1242        } while (0)
1243    #endif
1244    
1245    /***********************************************************************\
1246    * Name       : TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_BROADCAST
1247    * Purpose    : get socket option SO_BROADCAST
1248    * Input      : socketDescriptor - socket descriptor
1249    * Output     : flag   - 1 or 0
1250    *              result - TARGET_NATIVE_OK if no error occurred,
1251    *                       TARGET_NATIVE_ERROR otherwise
1252    * Return     : -
1253    * Side-effect: unknown
1254    * Notes      : -
1255    \***********************************************************************/
1256    
1257    #ifndef TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_BROADCAST
1258      #include <sys/types.h>
1259      #include <sys/socket.h>
1260      #include <netinet/tcp.h>
1261      #define TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_BROADCAST(socketDescriptor,flag,result) \
1262        do { \
1263          int __value; \
1264          socklen_t __len; \
1265          \
1266          flag=0; \
1267          \
1268          __len=sizeof(__value); \
1269          result=(getsockopt(socketDescriptor,SOL_SOCKET,SO_BROADCAST,&__value,&__len)==0)?TARGET_NATIVE_OK:TARGET_NATIVE_ERROR; \
1270          if (result==TARGET_NATIVE_OK) \
1271          { \
1272            assert(__len>=sizeof(__value)); \
1273          flag=__value; \          flag=__value; \
1274        } \        } \
1275      } while (0)      } while (0)

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

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