7 #ifndef __SDCC_pdk14 // Lack of memory - see RFE #605.
9 /* force alignment on sparc machines with gcc compiler */
10 #if defined(PORT_HOST) && defined(__sparc) && defined(__GNUC__)
11 # define LONG_ALIGNED __attribute__ ((aligned (4)))
18 unsigned char bytes
[4];
22 typedef union _short_map
24 unsigned char chars
[2];
26 } Short_Map
, *PShort_Map
;
28 typedef Short_Map Port
;
33 unsigned char bogus_ptr
[3]; ///< Overhead for TNI native interface.
34 unsigned char sin_addr
[16] LONG_ALIGNED
; ///< IP address. IPv4 address is in sin_addr[12-15] with MSB at sin_addr[12].
35 unsigned char sin_port_high
; ///< most significant byte of port number for the socket.
36 unsigned char sin_port_low
; ///< least significant byte of port number for the socket.
37 unsigned char sin_family
; ///< Ignored by DS80C400 implementation.
40 typedef unsigned int SocketHandle
;
42 #define INVALID_HANDLE_VALUE (SocketHandle) -1
44 int accept(SocketHandle handle
, struct sockaddr
* address
, unsigned int size
)
52 SocketHandle
Accept(SocketHandle handle
, PIP_V4 ip
, PPort port
)
54 struct sockaddr address
;
57 RetCode
= accept(handle
, &address
, sizeof(address
));
58 if (RetCode
!= INVALID_HANDLE_VALUE
)
60 ip
->l
= ((PIP_V4
) &address
.sin_addr
[12])->l
;
61 port
->chars
[0] = address
.sin_port_low
;
62 port
->chars
[1] = address
.sin_port_high
;
71 #ifndef __SDCC_pdk14 // Lack of memory.
72 IP_V4 ip
= {{1, 2, 3, 4}};
74 ASSERT(Accept(1, &ip
, &port
) == 0x1234);