755 |
* Name : TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_IP_MULTICAST_IF |
* Name : TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_IP_MULTICAST_IF |
756 |
* Purpose : set socket option IP_MULTICAST_IF |
* Purpose : set socket option IP_MULTICAST_IF |
757 |
* Input : socketDescriptor - socket descriptor |
* Input : socketDescriptor - socket descriptor |
758 |
* address - address |
* address - integer with IP address in host-format |
759 |
* Output : result - TARGET_NATIVE_OK if no error occurred, |
* Output : result - TARGET_NATIVE_OK if no error occurred, |
760 |
* TARGET_NATIVE_ERROR otherwise |
* TARGET_NATIVE_ERROR otherwise |
761 |
* Return : - |
* Return : - |
909 |
|
|
910 |
/***********************************************************************\ |
/***********************************************************************\ |
911 |
* Name : TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_TCP_NODELAY |
* Name : TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_TCP_NODELAY |
912 |
* Purpose : set socket option TCP_NODELAY |
* Purpose : get socket option TCP_NODELAY |
913 |
* Input : socketDescriptor - socket descriptor |
* Input : socketDescriptor - socket descriptor |
914 |
* Output : flag - 1 or 0 |
* Output : flag - 1 or 0 |
915 |
* result - TARGET_NATIVE_OK if no error occurred, |
* result - TARGET_NATIVE_OK if no error occurred, |
942 |
|
|
943 |
/***********************************************************************\ |
/***********************************************************************\ |
944 |
* Name : TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_SO_LINGER |
* Name : TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_SO_LINGER |
945 |
* Purpose : set socket option SO_LINGER |
* Purpose : get socket option SO_LINGER |
946 |
* Input : socketDescriptor - socket descriptor |
* Input : socketDescriptor - socket descriptor |
947 |
* Output : flag - 1 or 0 |
* Output : flag - 1 or 0 |
948 |
* value - linger value |
* value - linger value |
977 |
|
|
978 |
/***********************************************************************\ |
/***********************************************************************\ |
979 |
* Name : TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_SO_TIMEOUT |
* Name : TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_SO_TIMEOUT |
980 |
* Purpose : set socket option SO_TIMEOUT |
* Purpose : get socket option SO_TIMEOUT |
981 |
* Input : socketDescriptor - socket descriptor |
* Input : socketDescriptor - socket descriptor |
982 |
* Output : flag - 1 or 0 |
* Output : flag - 1 or 0 |
983 |
* result - TARGET_NATIVE_OK if no error occurred, |
* result - TARGET_NATIVE_OK if no error occurred, |
1009 |
|
|
1010 |
/***********************************************************************\ |
/***********************************************************************\ |
1011 |
* Name : TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_SO_SNDBUF |
* Name : TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_SO_SNDBUF |
1012 |
* Purpose : set socket option SO_SNDBUF |
* Purpose : get socket option SO_SNDBUF |
1013 |
* Input : socketDescriptor - socket descriptor |
* Input : socketDescriptor - socket descriptor |
1014 |
* Output : size - size of send buffer |
* Output : size - size of send buffer |
1015 |
* result - TARGET_NATIVE_OK if no error occurred, |
* result - TARGET_NATIVE_OK if no error occurred, |
1041 |
|
|
1042 |
/***********************************************************************\ |
/***********************************************************************\ |
1043 |
* Name : TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_SO_RCDBUF |
* Name : TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_SO_RCDBUF |
1044 |
* Purpose : set socket option SO_RCDBUF |
* Purpose : get socket option SO_RCDBUF |
1045 |
* Input : socketDescriptor - socket descriptor |
* Input : socketDescriptor - socket descriptor |
1046 |
* Output : size - size of receive buffer |
* Output : size - size of receive buffer |
1047 |
* result - TARGET_NATIVE_OK if no error occurred, |
* result - TARGET_NATIVE_OK if no error occurred, |
1073 |
|
|
1074 |
/***********************************************************************\ |
/***********************************************************************\ |
1075 |
* Name : TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_IP_TTL |
* Name : TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_IP_TTL |
1076 |
* Purpose : set socket option IP_TTL |
* Purpose : get socket option IP_TTL |
1077 |
* Input : socketDescriptor - socket descriptor |
* Input : socketDescriptor - socket descriptor |
1078 |
* Output : flag - 1 or 0 |
* Output : flag - 1 or 0 |
1079 |
* result - TARGET_NATIVE_OK if no error occurred, |
* result - TARGET_NATIVE_OK if no error occurred, |
1106 |
|
|
1107 |
/***********************************************************************\ |
/***********************************************************************\ |
1108 |
* Name : TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_IP_MULTICAST_IF |
* Name : TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_IP_MULTICAST_IF |
1109 |
* Purpose : set socket option IP_MULTICAST_IF |
* Purpose : get socket option IP_MULTICAST_IF |
1110 |
* Input : socketDescriptor - socket descriptor |
* Input : socketDescriptor - socket descriptor |
1111 |
* Output : address - result - 1 if no error occurred, 0 otherwise |
* Output : address - integer with IP address in host-format |
1112 |
* result - TARGET_NATIVE_OK if no error occurred, |
* result - TARGET_NATIVE_OK if no error occurred, |
1113 |
* TARGET_NATIVE_ERROR otherwise |
* TARGET_NATIVE_ERROR otherwise |
1114 |
* Return : - |
* Return : - |
1135 |
if (result==TARGET_NATIVE_OK) \ |
if (result==TARGET_NATIVE_OK) \ |
1136 |
{ \ |
{ \ |
1137 |
assert(__socketAddressLength>=sizeof(__socketAddress)); \ |
assert(__socketAddressLength>=sizeof(__socketAddress)); \ |
1138 |
|
address=ntohl(__socketAddress.sin_addr.s_addr); \ |
1139 |
|
} \ |
1140 |
|
} while (0) |
1141 |
|
#endif |
1142 |
|
|
1143 |
|
/***********************************************************************\ |
1144 |
|
* Name : TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_BIND_ADDRESS |
1145 |
|
* Purpose : get socket option SOCKOPT_SO_BINDADDR |
1146 |
|
* Input : socketDescriptor - socket descriptor |
1147 |
|
* Output : address - integer with IP address in host-format |
1148 |
|
* result - TARGET_NATIVE_OK if no error occurred, |
1149 |
|
* TARGET_NATIVE_ERROR otherwise |
1150 |
|
* Return : - |
1151 |
|
* Side-effect: unknown |
1152 |
|
* Notes : - |
1153 |
|
\***********************************************************************/ |
1154 |
|
|
1155 |
|
#ifndef TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_BIND_ADDRESS |
1156 |
|
#include <sys/types.h> |
1157 |
|
#include <sys/socket.h> |
1158 |
|
#include <netinet/in.h> |
1159 |
|
#define TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_BIND_ADDRESS(socketDescriptor,address,result) \ |
1160 |
|
do { \ |
1161 |
|
struct sockaddr_in __socketAddress; \ |
1162 |
|
socklen_t __socketAddressLength; \ |
1163 |
|
\ |
1164 |
|
address=0;\ |
1165 |
|
\ |
1166 |
|
memset(&__socketAddress,0,sizeof(__socketAddress)); \ |
1167 |
|
__socketAddressLength=sizeof(__socketAddress); \ |
1168 |
|
result=(getsockname(socketDescriptor,(struct sockaddr*)&__socketAddress,&__socketAddressLength)==0)?TARGET_NATIVE_OK:TARGET_NATIVE_ERROR; \ |
1169 |
|
if (result==TARGET_NATIVE_OK) \ |
1170 |
|
{ \ |
1171 |
|
assert(__socketAddressLength>=sizeof(__socketAddress)); \ |
1172 |
address=ntohl(__socketAddress.sin_addr.s_addr); \ |
address=ntohl(__socketAddress.sin_addr.s_addr); \ |
1173 |
} \ |
} \ |
1174 |
} while (0) |
} while (0) |