33 #define epicsExportSharedSymbols 59 (
int)pclient->
sock, (
unsigned) pclient->
addr.sin_addr.s_addr );
70 unsigned transferSize = (unsigned) status;
71 if ( transferSize >= pclient->
send.
stk ) {
77 unsigned bytesLeft = pclient->
send.
stk - transferSize;
84 int causeWasSocketHangup = 0;
99 "CAS: Out of network buffers, retrying send in 15 seconds\n" );
111 causeWasSocketHangup = 1;
116 sockErrBuf,
sizeof ( sockErrBuf ) );
126 if ( ! causeWasSocketHangup ) {
142 sockErrBuf,
sizeof ( sockErrBuf ) );
163 DLOG ( 3, (
"------------------------------\n\n" ) );
192 pMsg = (
caHdr * ) pDG;
200 pDG +=
sizeof (
caHdr);
201 sizeDG -=
sizeof (
caHdr);
204 status = sendto ( pclient->
sock, pDG, sizeDG, 0,
205 (
struct sockaddr *)&pclient->
addr,
sizeof(pclient->
addr) );
207 if ( status >= sizeDG ) {
212 "CAS: System failed to send entire udp frame?\n" );
219 sockErrBuf,
sizeof ( sockErrBuf ) );
234 DLOG ( 3, (
"------------------------------\n\n" ) );
260 if ( payloadSize > UINT_MAX -
sizeof (
caHdr ) - 8u ) {
266 msgSize = alignedPayloadSize +
sizeof (
caHdr );
267 if ( alignedPayloadSize >= 0xffff || nElem >= 0xffff ) {
286 if ( pclient->
proto == IPPROTO_TCP) {
289 else if ( pclient->
proto == IPPROTO_UDP ) {
299 pMsg->
m_cmmd = htons(response);
301 pMsg->
m_cid = htonl(cid);
303 if (alignedPayloadSize < 0xffff && nElem < 0xffff) {
307 *ppPayload = (
void *) (pMsg + 1);
313 pW32[0] = htonl(alignedPayloadSize);
314 pW32[1] = htonl(nElem);
316 *ppPayload = (
void *) (pW32 + 2);
320 if ( alignedPayloadSize > payloadSize ) {
321 char *p = (
char * ) *ppPayload;
322 memset ( p + payloadSize,
'\0',
323 alignedPayloadSize - payloadSize );
332 pMsg->
m_cid = htonl ( cid );
343 pLW[1] = htonl(count);
357 assert ( size <= ntohl ( *pLW ) );
358 pLW[0] = htonl ( size );
359 size +=
sizeof (
caHdr ) + 2 *
sizeof ( *pLW );
364 size +=
sizeof (
caHdr );
LIBCOM_API void epicsStdCall epicsSocketDestroy(SOCKET s)
ca_uint32_t rsrvGetUInt32(struct message_buffer *recv)
#define SOCK_ECONNABORTED
struct message_buffer recv
int rsrv_version_reply(struct client *client)
#define assert(exp)
Declare that a condition should be true.
LIBCOM_API void epicsStdCall epicsSignalRaiseSigAlarm(struct epicsThreadOSD *)
enum epicsSocketSystemCallInterruptMechanismQueryInfo epicsSocketSystemCallInterruptMechanismQuery()
ca_uint16_t rsrvGetUInt16(struct message_buffer *recv)
unsigned short ca_uint16_t
Miscellaneous macro definitions.
epicsSocketSystemCallInterruptMechanismQueryInfo
void epicsSocketConvertErrnoToString(char *pBuf, unsigned bufSize)
#define SEND_UNLOCK(CLIENT)
#define CA_MESSAGE_ALIGN(A)
struct message_buffer send
int epicsStdCall epicsTimeGetCurrent(epicsTimeStamp *pDest)
Get current time into *pDest.
#define sequenceNoIsValid
void casExpandSendBuffer(struct client *pClient, ca_uint32_t size)
int errlogPrintf(const char *pFormat,...)
int cas_copy_in_header(struct client *pclient, ca_uint16_t response, ca_uint32_t payloadSize, ca_uint16_t dataType, ca_uint32_t nElem, ca_uint32_t cid, ca_uint32_t responseSpecific, void **ppPayload)
void cas_set_header_cid(struct client *pClient, ca_uint32_t cid)
void cas_commit_msg(struct client *pClient, ca_uint32_t size)
#define DLOG(LEVEL, ARGSINPAREN)
LIBCOM_API void epicsStdCall epicsThreadSleep(double seconds)
Block the calling thread for at least the specified time.
void cas_send_dg_msg(struct client *pclient)
unsigned minor_version_number
OS-independent routines for ignoring Posix signals.
EPICS time-stamps (epicsTimeStamp), epicsTime C++ class and C functions for handling wall-clock times...
epicsTimeStamp time_at_last_send
void cas_send_bs_msg(struct client *pclient, int lock_needed)
void cas_set_header_count(struct client *pClient, ca_uint32_t count)
#define SEND_LOCK(CLIENT)
unsigned epicsStdCall ipAddrToDottedIP(const struct sockaddr_in *paddr, char *pBuf, unsigned bufSize)
#define ECA_16KARRAYCLIENT