call epics builtin inline byte swapping
This commit is contained in:
@@ -1416,7 +1416,7 @@ bool cac::eventRespAction ( tcpiiu &iiu, const caHdrLargeArray &hdr, void *pMsgB
|
||||
pMsgBdy, pMsgBdy, false, hdr.m_count);
|
||||
}
|
||||
else {
|
||||
caStatus = htonl ( ECA_BADTYPE );
|
||||
caStatus = epicsHTON32 ( ECA_BADTYPE );
|
||||
}
|
||||
# endif
|
||||
|
||||
@@ -1506,12 +1506,12 @@ bool cac::exceptionRespAction ( tcpiiu &iiu, const caHdrLargeArray &hdr, void *p
|
||||
return false;
|
||||
}
|
||||
caHdrLargeArray req;
|
||||
req.m_cmmd = ntohs ( pReq->m_cmmd );
|
||||
req.m_postsize = ntohs ( pReq->m_postsize );
|
||||
req.m_dataType = ntohs ( pReq->m_dataType );
|
||||
req.m_count = ntohs ( pReq->m_count );
|
||||
req.m_cid = ntohl ( pReq->m_cid );
|
||||
req.m_available = ntohl ( pReq->m_available );
|
||||
req.m_cmmd = epicsNTOH16 ( pReq->m_cmmd );
|
||||
req.m_postsize = epicsNTOH16 ( pReq->m_postsize );
|
||||
req.m_dataType = epicsNTOH16 ( pReq->m_dataType );
|
||||
req.m_count = epicsNTOH16 ( pReq->m_count );
|
||||
req.m_cid = epicsNTOH32 ( pReq->m_cid );
|
||||
req.m_available = epicsNTOH32 ( pReq->m_available );
|
||||
const ca_uint32_t * pLW = reinterpret_cast < const ca_uint32_t * > ( pReq + 1 );
|
||||
if ( req.m_postsize == 0xffff ) {
|
||||
static const unsigned annexSize =
|
||||
@@ -1520,8 +1520,8 @@ bool cac::exceptionRespAction ( tcpiiu &iiu, const caHdrLargeArray &hdr, void *p
|
||||
if ( hdr.m_postsize < bytesSoFar ) {
|
||||
return false;
|
||||
}
|
||||
req.m_postsize = ntohl ( pLW[0] );
|
||||
req.m_count = ntohl ( pLW[1] );
|
||||
req.m_postsize = epicsNTOH32 ( pLW[0] );
|
||||
req.m_count = epicsNTOH32 ( pLW[1] );
|
||||
pLW += 2u;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
#include "envDefs.h"
|
||||
#include "errlog.h"
|
||||
#include "osiWireFormat.h"
|
||||
|
||||
#include "bhe.h"
|
||||
#include "udpiiu.h"
|
||||
@@ -53,8 +54,8 @@ int main ( int, char ** )
|
||||
|
||||
memset ( (char *) &addr, 0 , sizeof (addr) );
|
||||
addr.ia.sin_family = AF_INET;
|
||||
addr.ia.sin_addr.s_addr = htonl (INADDR_ANY);
|
||||
addr.ia.sin_port = htons ( 0 ); // any port
|
||||
addr.ia.sin_addr.s_addr = epicsHTON32 ( INADDR_ANY );
|
||||
addr.ia.sin_port = epicsHTON16 ( 0 ); // any port
|
||||
status = bind ( sock, &addr.sa, sizeof (addr) );
|
||||
if ( status < 0 ) {
|
||||
socket_close ( sock );
|
||||
@@ -81,7 +82,7 @@ int main ( int, char ** )
|
||||
&addr.sa, &addrSize );
|
||||
if ( status >= static_cast <int> ( sizeof ( *pCurMsg ) ) ) {
|
||||
pCurMsg = reinterpret_cast < caHdr * > ( buf );
|
||||
if ( htons ( pCurMsg->m_cmmd ) == REPEATER_CONFIRM ) {
|
||||
if ( epicsHTON16 ( pCurMsg->m_cmmd ) == REPEATER_CONFIRM ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -122,7 +123,7 @@ int main ( int, char ** )
|
||||
|
||||
pCurMsg = reinterpret_cast < const caHdr * > ( ( pCurBuf = buf ) );
|
||||
while ( status >= static_cast < int > ( sizeof ( *pCurMsg ) ) ) {
|
||||
if ( ntohs ( pCurMsg->m_cmmd ) == CA_PROTO_RSRV_IS_UP ) {
|
||||
if ( epicsNTOH16 ( pCurMsg->m_cmmd ) == CA_PROTO_RSRV_IS_UP ) {
|
||||
struct sockaddr_in ina;
|
||||
|
||||
/*
|
||||
@@ -131,12 +132,12 @@ int main ( int, char ** )
|
||||
*
|
||||
* old servers:
|
||||
* 1) set this field to one of the ip addresses of the host _or_
|
||||
* 2) set this field to htonl(INADDR_ANY)
|
||||
* 2) set this field to epicsHTON32(INADDR_ANY)
|
||||
* new servers:
|
||||
* always set this field to htonl(INADDR_ANY)
|
||||
* always set this field to epicsHTON32(INADDR_ANY)
|
||||
*
|
||||
* clients always assume that if this
|
||||
* field is set to something that isnt htonl(INADDR_ANY)
|
||||
* field is set to something that isnt epicsHTON32(INADDR_ANY)
|
||||
* then it is the overriding IP address of the server.
|
||||
*/
|
||||
ina.sin_family = AF_INET;
|
||||
@@ -150,7 +151,7 @@ int main ( int, char ** )
|
||||
* old servers dont supply this and the
|
||||
* default port must be assumed
|
||||
*/
|
||||
ina.sin_port = ntohs ( serverPort );
|
||||
ina.sin_port = epicsNTOH16 ( serverPort );
|
||||
}
|
||||
|
||||
bool netChange;
|
||||
@@ -188,9 +189,9 @@ int main ( int, char ** )
|
||||
errlogPrintf ("CA server beacon anomaly: %s %s\n", date, host );
|
||||
}
|
||||
}
|
||||
pCurBuf += sizeof ( *pCurMsg ) + ntohl ( pCurMsg->m_postsize );
|
||||
pCurBuf += sizeof ( *pCurMsg ) + epicsNTOH32 ( pCurMsg->m_postsize );
|
||||
pCurMsg = reinterpret_cast < const caHdr * > ( pCurBuf );
|
||||
status -= sizeof ( *pCurMsg ) + ntohl ( pCurMsg->m_postsize );
|
||||
status -= sizeof ( *pCurMsg ) + epicsNTOH32 ( pCurMsg->m_postsize );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "osiSock.h"
|
||||
#include "osiWireFormat.h"
|
||||
|
||||
#include "iocinf.h"
|
||||
#include "caProto.h"
|
||||
@@ -44,10 +45,10 @@ typedef unsigned long arrayElementCount;
|
||||
*
|
||||
*/
|
||||
|
||||
#define dbr_ntohs(A) (ntohs(A))
|
||||
#define dbr_ntohl(A) (ntohl(A))
|
||||
#define dbr_htons(A) (htons(A))
|
||||
#define dbr_htonl(A) (htonl(A))
|
||||
#define dbr_ntohs(A) (epicsNTOH16(A))
|
||||
#define dbr_ntohl(A) (epicsNTOH32(A))
|
||||
#define dbr_htons(A) (epicsHTON16(A))
|
||||
#define dbr_htonl(A) (epicsHTON32(A))
|
||||
|
||||
/*
|
||||
* CVRT_STRING()
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "envDefs.h"
|
||||
#include "epicsAssert.h"
|
||||
#include "errlog.h"
|
||||
#include "osiWireFormat.h"
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include "addrList.h"
|
||||
@@ -157,7 +158,7 @@ static void forcePort ( ELLLIST *pList, unsigned short port )
|
||||
pNode = ( osiSockAddrNode * ) ellFirst ( pList ); // X aCC 749
|
||||
while ( pNode ) {
|
||||
if ( pNode->addr.sa.sa_family == AF_INET ) {
|
||||
pNode->addr.ia.sin_port = htons (port);
|
||||
pNode->addr.ia.sin_port = epicsHTON16 ( port );
|
||||
}
|
||||
pNode = ( osiSockAddrNode * ) ellNext ( &pNode->node ); // X aCC 749
|
||||
}
|
||||
@@ -216,8 +217,8 @@ extern "C" void epicsShareAPI configureChannelAccessAddressList
|
||||
* with the loop back interface
|
||||
*/
|
||||
pNewNode->addr.ia.sin_family = AF_INET;
|
||||
pNewNode->addr.ia.sin_addr.s_addr = htonl ( INADDR_LOOPBACK );
|
||||
pNewNode->addr.ia.sin_port = htons ( port );
|
||||
pNewNode->addr.ia.sin_addr.s_addr = epicsHTON32 ( INADDR_LOOPBACK );
|
||||
pNewNode->addr.ia.sin_port = epicsHTON16 ( port );
|
||||
memset ( &pNewNode->netMask, '\0', sizeof ( pNewNode->netMask ) );
|
||||
ellAdd ( &tmpList, &pNewNode->node );
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "iocinf.h"
|
||||
#include "cac.h"
|
||||
#include "osiWireFormat.h"
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include "udpiiu.h"
|
||||
@@ -166,10 +167,10 @@ bool nciu::searchMsg ( unsigned short retrySeqNumber, unsigned &retryNoForThisCh
|
||||
caHdr msg;
|
||||
bool success;
|
||||
|
||||
msg.m_cmmd = htons ( CA_PROTO_SEARCH );
|
||||
msg.m_cmmd = epicsHTON16 ( CA_PROTO_SEARCH );
|
||||
msg.m_available = this->getId ();
|
||||
msg.m_dataType = htons ( DONTREPLY );
|
||||
msg.m_count = htons ( CA_MINOR_PROTOCOL_REVISION );
|
||||
msg.m_dataType = epicsHTON16 ( DONTREPLY );
|
||||
msg.m_count = epicsHTON16 ( CA_MINOR_PROTOCOL_REVISION );
|
||||
msg.m_cid = this->getId ();
|
||||
|
||||
success = this->piiu->pushDatagramMsg ( msg,
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
#include "tsDLList.h"
|
||||
#include "envDefs.h"
|
||||
#include "tsFreeList.h"
|
||||
#include "osiWireFormat.h"
|
||||
|
||||
#include "iocinf.h"
|
||||
#include "caProto.h"
|
||||
@@ -151,8 +152,8 @@ LOCAL makeSocketReturn makeSocket ( unsigned short port, bool reuseAddr )
|
||||
|
||||
memset ( (char *) &bd, 0, sizeof (bd) );
|
||||
bd.ia.sin_family = AF_INET;
|
||||
bd.ia.sin_addr.s_addr = htonl (INADDR_ANY);
|
||||
bd.ia.sin_port = htons (port);
|
||||
bd.ia.sin_addr.s_addr = epicsHTON32 (INADDR_ANY);
|
||||
bd.ia.sin_port = epicsHTON16 (port);
|
||||
status = bind ( msr.sock, &bd.sa, (int) sizeof(bd) );
|
||||
if ( status < 0 ) {
|
||||
msr.errNumber = SOCKERRNO;
|
||||
@@ -181,7 +182,7 @@ LOCAL makeSocketReturn makeSocket ( unsigned short port, bool reuseAddr )
|
||||
repeaterClient::repeaterClient ( const osiSockAddr &fromIn ) :
|
||||
from ( fromIn ), sock ( INVALID_SOCKET )
|
||||
{
|
||||
debugPrintf ( ( "new client %u\n", ntohs ( from.ia.sin_port ) ) );
|
||||
debugPrintf ( ( "new client %u\n", epicsNTOH16 ( from.ia.sin_port ) ) );
|
||||
}
|
||||
|
||||
bool repeaterClient::connect ()
|
||||
@@ -216,7 +217,7 @@ bool repeaterClient::sendConfirm () // X aCC 361
|
||||
|
||||
caHdr confirm;
|
||||
memset ( (char *) &confirm, '\0', sizeof (confirm) );
|
||||
confirm.m_cmmd = htons ( REPEATER_CONFIRM );
|
||||
confirm.m_cmmd = epicsHTON16 ( REPEATER_CONFIRM );
|
||||
confirm.m_available = this->from.ia.sin_addr.s_addr;
|
||||
status = send ( this->sock, (char *) &confirm,
|
||||
sizeof (confirm), 0 );
|
||||
@@ -241,13 +242,13 @@ bool repeaterClient::sendMessage ( const void *pBuf, unsigned bufSize ) // X aCC
|
||||
status = send ( this->sock, (char *) pBuf, bufSize, 0 );
|
||||
if ( status >= 0 ) {
|
||||
assert ( static_cast <unsigned> ( status ) == bufSize );
|
||||
debugPrintf ( ("Sent to %u\n", ntohs ( this->from.ia.sin_port ) ) );
|
||||
debugPrintf ( ("Sent to %u\n", epicsNTOH16 ( this->from.ia.sin_port ) ) );
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
int errnoCpy = SOCKERRNO;
|
||||
if ( errnoCpy == SOCK_ECONNREFUSED ) {
|
||||
debugPrintf ( ("Client refused message %u\n", ntohs ( this->from.ia.sin_port ) ) );
|
||||
debugPrintf ( ("Client refused message %u\n", epicsNTOH16 ( this->from.ia.sin_port ) ) );
|
||||
}
|
||||
else {
|
||||
debugPrintf ( ( "CA Repeater: UDP send err was \"%s\"\n", SOCKERRSTR (errnoCpy) ) );
|
||||
@@ -261,7 +262,7 @@ repeaterClient::~repeaterClient ()
|
||||
if ( this->sock != INVALID_SOCKET ) {
|
||||
socket_close ( this->sock );
|
||||
}
|
||||
debugPrintf ( ( "Deleted client %u\n", ntohs ( this->from.ia.sin_port ) ) );
|
||||
debugPrintf ( ( "Deleted client %u\n", epicsNTOH16 ( this->from.ia.sin_port ) ) );
|
||||
}
|
||||
|
||||
inline void * repeaterClient::operator new ( size_t size )
|
||||
@@ -283,7 +284,7 @@ inline void repeaterClient::destroy ()
|
||||
|
||||
inline unsigned short repeaterClient::port () const
|
||||
{
|
||||
return ntohs ( this->from.ia.sin_port );
|
||||
return epicsNTOH16 ( this->from.ia.sin_port );
|
||||
}
|
||||
|
||||
inline bool repeaterClient::identicalAddress ( const osiSockAddr &fromIn )
|
||||
@@ -391,7 +392,7 @@ LOCAL void register_new_client ( osiSockAddr &from )
|
||||
/*
|
||||
* the repeater and its clients must be on the same host
|
||||
*/
|
||||
if ( htonl ( INADDR_LOOPBACK ) != from.ia.sin_addr.s_addr ) {
|
||||
if ( epicsHTON32 ( INADDR_LOOPBACK ) != from.ia.sin_addr.s_addr ) {
|
||||
static SOCKET testSock = INVALID_SOCKET;
|
||||
static bool init = false;
|
||||
|
||||
@@ -463,7 +464,7 @@ LOCAL void register_new_client ( osiSockAddr &from )
|
||||
client_list.remove ( *pNewClient );
|
||||
pNewClient->destroy ();
|
||||
debugPrintf ( ( "Deleted repeater client=%u (error while sending ack)\n",
|
||||
ntohs (from.ia.sin_port) ) );
|
||||
epicsNTOH16 (from.ia.sin_port) ) );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -472,7 +473,7 @@ LOCAL void register_new_client ( osiSockAddr &from )
|
||||
*/
|
||||
caHdr noop;
|
||||
memset ( (char *) &noop, '\0', sizeof ( noop ) );
|
||||
noop.m_cmmd = htons ( CA_PROTO_VERSION );
|
||||
noop.m_cmmd = epicsHTON16 ( CA_PROTO_VERSION );
|
||||
fanOut ( from, &noop, sizeof ( noop ) );
|
||||
|
||||
if ( newClient ) {
|
||||
@@ -555,7 +556,7 @@ void ca_repeater ()
|
||||
* will register a new client
|
||||
*/
|
||||
if ( ( (size_t) size) >= sizeof (*pMsg) ) {
|
||||
if ( ntohs ( pMsg->m_cmmd ) == REPEATER_REGISTER ) {
|
||||
if ( epicsNTOH16 ( pMsg->m_cmmd ) == REPEATER_REGISTER ) {
|
||||
register_new_client ( from );
|
||||
|
||||
/*
|
||||
@@ -567,7 +568,7 @@ void ca_repeater ()
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if ( ntohs ( pMsg->m_cmmd ) == CA_PROTO_RSRV_IS_UP ) {
|
||||
else if ( epicsNTOH16 ( pMsg->m_cmmd ) == CA_PROTO_RSRV_IS_UP ) {
|
||||
if ( pMsg->m_available == 0u ) {
|
||||
pMsg->m_available = from.ia.sin_addr.s_addr;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "envDefs.h"
|
||||
#include "osiProcess.h"
|
||||
#include "osiWireFormat.h"
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include "addrList.h"
|
||||
@@ -106,8 +107,8 @@ udpiiu::udpiiu ( cac &cac ) :
|
||||
*/
|
||||
memset ( (char *)&addr, 0 , sizeof (addr) );
|
||||
addr.ia.sin_family = AF_INET;
|
||||
addr.ia.sin_addr.s_addr = htonl (INADDR_ANY);
|
||||
addr.ia.sin_port = htons (PORT_ANY); // X aCC 818
|
||||
addr.ia.sin_addr.s_addr = epicsHTON32 (INADDR_ANY);
|
||||
addr.ia.sin_port = epicsHTON16 (PORT_ANY); // X aCC 818
|
||||
status = bind (this->sock, &addr.sa, sizeof (addr) );
|
||||
if ( status < 0 ) {
|
||||
socket_close (this->sock);
|
||||
@@ -130,7 +131,7 @@ udpiiu::udpiiu ( cac &cac ) :
|
||||
this->pCAC ()->printf ( "CAC: UDP socket was not inet addr family\n" );
|
||||
throwWithLocation ( noSocket () );
|
||||
}
|
||||
this->localPort = ntohs ( tmpAddr.ia.sin_port );
|
||||
this->localPort = epicsNTOH16 ( tmpAddr.ia.sin_port );
|
||||
}
|
||||
|
||||
this->nBytesInXmitBuf = 0u;
|
||||
@@ -340,21 +341,21 @@ void epicsShareAPI caRepeaterRegistrationMessage (
|
||||
* this will only work with 3.13 beta 12 CA repeaters or later
|
||||
*/
|
||||
saddr.ia.sin_family = AF_INET;
|
||||
saddr.ia.sin_addr.s_addr = htonl ( INADDR_LOOPBACK );
|
||||
saddr.ia.sin_port = htons ( port );
|
||||
saddr.ia.sin_addr.s_addr = epicsHTON32 ( INADDR_LOOPBACK );
|
||||
saddr.ia.sin_port = epicsHTON16 ( port );
|
||||
}
|
||||
else {
|
||||
saddr.ia.sin_port = htons ( port );
|
||||
saddr.ia.sin_port = epicsHTON16 ( port );
|
||||
}
|
||||
}
|
||||
else {
|
||||
saddr.ia.sin_family = AF_INET;
|
||||
saddr.ia.sin_addr.s_addr = htonl ( INADDR_LOOPBACK );
|
||||
saddr.ia.sin_port = htons ( port );
|
||||
saddr.ia.sin_addr.s_addr = epicsHTON32 ( INADDR_LOOPBACK );
|
||||
saddr.ia.sin_port = epicsHTON16 ( port );
|
||||
}
|
||||
|
||||
memset ( (char *) &msg, 0, sizeof (msg) );
|
||||
msg.m_cmmd = htons ( REPEATER_REGISTER ); // X aCC 818
|
||||
msg.m_cmmd = epicsHTON16 ( REPEATER_REGISTER ); // X aCC 818
|
||||
msg.m_available = saddr.ia.sin_addr.s_addr;
|
||||
|
||||
/*
|
||||
@@ -436,8 +437,8 @@ void epicsShareAPI caStartRepeaterIfNotInstalled ( unsigned repeaterPort )
|
||||
ca_uint16_t port = static_cast < ca_uint16_t > ( repeaterPort );
|
||||
memset ( (char *) &bd, 0, sizeof ( bd ) );
|
||||
bd.ia.sin_family = AF_INET;
|
||||
bd.ia.sin_addr.s_addr = htonl ( INADDR_ANY );
|
||||
bd.ia.sin_port = htons ( port );
|
||||
bd.ia.sin_addr.s_addr = epicsHTON32 ( INADDR_ANY );
|
||||
bd.ia.sin_port = epicsHTON16 ( port );
|
||||
status = bind ( tmpSock, &bd.sa, sizeof ( bd ) );
|
||||
if ( status < 0 ) {
|
||||
if ( SOCKERRNO == SOCK_EADDRINUSE ) {
|
||||
@@ -536,7 +537,7 @@ bool udpiiu::searchRespAction ( const caHdr &msg, // X aCC 361
|
||||
*/
|
||||
if ( msg.m_postsize >= sizeof (*pMinorVersion) ){
|
||||
pMinorVersion = (ca_uint16_t *) ( &msg + 1 );
|
||||
minorVersion = ntohs ( *pMinorVersion );
|
||||
minorVersion = epicsNTOH16 ( *pMinorVersion );
|
||||
}
|
||||
else {
|
||||
minorVersion = CA_UKN_MINOR_VERSION;
|
||||
@@ -558,14 +559,14 @@ bool udpiiu::searchRespAction ( const caHdr &msg, // X aCC 361
|
||||
else {
|
||||
serverAddr.ia.sin_addr = addr.ia.sin_addr;
|
||||
}
|
||||
serverAddr.ia.sin_port = htons ( msg.m_dataType );
|
||||
serverAddr.ia.sin_port = epicsHTON16 ( msg.m_dataType );
|
||||
}
|
||||
else if ( CA_V45 (minorVersion) ) {
|
||||
serverAddr.ia.sin_port = htons ( msg.m_dataType );
|
||||
serverAddr.ia.sin_port = epicsHTON16 ( msg.m_dataType );
|
||||
serverAddr.ia.sin_addr = addr.ia.sin_addr;
|
||||
}
|
||||
else {
|
||||
serverAddr.ia.sin_port = htons ( this->serverPort );
|
||||
serverAddr.ia.sin_port = epicsHTON16 ( this->serverPort );
|
||||
serverAddr.ia.sin_addr = addr.ia.sin_addr;
|
||||
}
|
||||
|
||||
@@ -596,25 +597,25 @@ bool udpiiu::beaconAction ( const caHdr &msg,
|
||||
*
|
||||
* old servers:
|
||||
* 1) set this field to one of the ip addresses of the host _or_
|
||||
* 2) set this field to htonl(INADDR_ANY)
|
||||
* 2) set this field to epicsHTON32(INADDR_ANY)
|
||||
* new servers:
|
||||
* always set this field to htonl(INADDR_ANY)
|
||||
* always set this field to epicsHTON32(INADDR_ANY)
|
||||
*
|
||||
* clients always assume that if this
|
||||
* field is set to something that isnt htonl(INADDR_ANY)
|
||||
* field is set to something that isnt epicsHTON32(INADDR_ANY)
|
||||
* then it is the overriding IP address of the server.
|
||||
*/
|
||||
ina.sin_family = AF_INET;
|
||||
ina.sin_addr.s_addr = msg.m_available;
|
||||
if ( msg.m_count != 0 ) {
|
||||
ina.sin_port = htons ( msg.m_count );
|
||||
ina.sin_port = epicsHTON16 ( msg.m_count );
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* old servers dont supply this and the
|
||||
* default port must be assumed
|
||||
*/
|
||||
ina.sin_port = htons ( this->serverPort );
|
||||
ina.sin_port = epicsHTON16 ( this->serverPort );
|
||||
}
|
||||
|
||||
this->pCAC ()->beaconNotify ( ina, currentTime );
|
||||
@@ -646,12 +647,12 @@ bool udpiiu::exceptionRespAction ( const caHdr &msg,
|
||||
|
||||
if ( msg.m_postsize > sizeof ( caHdr ) ){
|
||||
errlogPrintf ( "error condition \"%s\" detected by %s with context \"%s\" at %s\n",
|
||||
ca_message ( htonl ( msg.m_available ) ),
|
||||
ca_message ( epicsHTON32 ( msg.m_available ) ),
|
||||
name, reinterpret_cast <const char *> ( &reqMsg + 1 ), date );
|
||||
}
|
||||
else{
|
||||
errlogPrintf ( "error condition \"%s\" detected by %s at %s\n",
|
||||
ca_message ( htonl ( msg.m_available ) ), name, date );
|
||||
ca_message ( epicsHTON32 ( msg.m_available ) ), name, date );
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -680,10 +681,10 @@ void udpiiu::postMsg ( const osiSockAddr & net_addr,
|
||||
/*
|
||||
* fix endian of bytes
|
||||
*/
|
||||
pCurMsg->m_postsize = ntohs ( pCurMsg->m_postsize );
|
||||
pCurMsg->m_cmmd = ntohs ( pCurMsg->m_cmmd );
|
||||
pCurMsg->m_dataType = ntohs ( pCurMsg->m_dataType );
|
||||
pCurMsg->m_count = ntohs ( pCurMsg->m_count );
|
||||
pCurMsg->m_postsize = epicsNTOH16 ( pCurMsg->m_postsize );
|
||||
pCurMsg->m_cmmd = epicsNTOH16 ( pCurMsg->m_cmmd );
|
||||
pCurMsg->m_dataType = epicsNTOH16 ( pCurMsg->m_dataType );
|
||||
pCurMsg->m_count = epicsNTOH16 ( pCurMsg->m_count );
|
||||
|
||||
#if 0
|
||||
printf ( "UDP Cmd=%3d Type=%3d Count=%4d Size=%4d",
|
||||
@@ -762,7 +763,7 @@ bool udpiiu::pushDatagramMsg ( const caHdr &msg, const void *pExt, ca_uint16_t e
|
||||
char *pDest = (char *) ( pbufmsg + 1 );
|
||||
memset ( pDest + extsize, '\0', alignedExtSize - extsize );
|
||||
}
|
||||
pbufmsg->m_postsize = htons ( alignedExtSize );
|
||||
pbufmsg->m_postsize = epicsHTON16 ( alignedExtSize );
|
||||
this->nBytesInXmitBuf += msgsize;
|
||||
|
||||
return true;
|
||||
@@ -854,17 +855,17 @@ void udpiiu::wakeupMsg ()
|
||||
}
|
||||
|
||||
caHdr msg;
|
||||
msg.m_cmmd = htons ( CA_PROTO_VERSION );
|
||||
msg.m_available = htonl ( 0u );
|
||||
msg.m_dataType = htons ( 0u );
|
||||
msg.m_count = htons ( 0u );
|
||||
msg.m_cid = htonl ( 0u );
|
||||
msg.m_postsize = htons ( 0u );
|
||||
msg.m_cmmd = epicsHTON16 ( CA_PROTO_VERSION );
|
||||
msg.m_available = epicsHTON32 ( 0u );
|
||||
msg.m_dataType = epicsHTON16 ( 0u );
|
||||
msg.m_count = epicsHTON16 ( 0u );
|
||||
msg.m_cid = epicsHTON32 ( 0u );
|
||||
msg.m_postsize = epicsHTON16 ( 0u );
|
||||
|
||||
osiSockAddr addr;
|
||||
addr.ia.sin_family = AF_INET;
|
||||
addr.ia.sin_addr.s_addr = htonl ( INADDR_LOOPBACK );
|
||||
addr.ia.sin_port = htons ( this->localPort );
|
||||
addr.ia.sin_addr.s_addr = epicsHTON32 ( INADDR_LOOPBACK );
|
||||
addr.ia.sin_port = epicsHTON16 ( this->localPort );
|
||||
|
||||
// send a wakeup msg so the UDP recv thread will exit
|
||||
int status = sendto ( this->sock, reinterpret_cast < const char * > ( &msg ),
|
||||
|
||||
Reference in New Issue
Block a user