remove param from util_addrChange; add comms_getIsServer; save bt_addr

as part of comms.
This commit is contained in:
ehouse 2006-09-08 07:14:24 +00:00
parent f46ae953e8
commit 975226cc4e
3 changed files with 21 additions and 5 deletions

View file

@ -246,6 +246,10 @@ addrFromStream( CommsAddrRec* addrP, XWStreamCtxt* stream )
/* XP_ASSERT( 0 ); */
break;
case COMMS_CONN_BT:
stringFromStreamHere( stream, addr.u.bt.hostName,
sizeof(addr.u.bt.hostName) );
stream_getBytes( stream, &addr.u.bt.btAddr, sizeof(addr.u.bt.btAddr) );
break;
case COMMS_CONN_IR:
/* nothing to save */
break;
@ -381,6 +385,9 @@ addrToStream( XWStreamCtxt* stream, CommsAddrRec* addrP )
break;
#endif
case COMMS_CONN_BT:
stringToStream( stream, addr.u.bt.hostName );
stream_putBytes( stream, &addr.u.bt.btAddr, sizeof(addr.u.bt.btAddr) );
break;
case COMMS_CONN_IR:
/* nothing to save */
break;
@ -466,7 +473,7 @@ comms_setAddr( CommsCtxt* comms, const CommsAddrRec* addr )
{
XP_ASSERT( comms != NULL );
#ifdef BEYOND_IR
util_addrChange( comms->util, &comms->addr, addr, comms->isServer );
util_addrChange( comms->util, &comms->addr, addr );
#endif
XP_MEMCPY( &comms->addr, addr, sizeof(comms->addr) );
@ -503,6 +510,12 @@ comms_getConType( CommsCtxt* comms )
return comms->addr.conType;
} /* comms_getConType */
XP_Bool
comms_getIsServer( CommsCtxt* comms )
{
return comms->isServer;
}
/* Send a message using the sequentially next MsgID. Save the message so
* resend can work. */
XP_S16
@ -698,7 +711,8 @@ comms_resendAll( CommsCtxt* comms )
if ( result == 0 && oneResult != 0 ) {
result = oneResult;
}
XP_STATUSF( "resend: msgid=" XP_LD "; rslt=%d", msg->msgID, oneResult );
XP_STATUSF( "resend: msgid=" XP_LD "; rslt=%d",
msg->msgID, oneResult );
}
return result;

View file

@ -45,6 +45,7 @@ typedef enum {
/* on Palm BtLibDeviceAddressType is a 48-bit quantity. Linux's typeis the
same size. Goal is something all platforms support */
typedef XP_U8 XP_BtAddr[6];
typedef XP_UCHAR XP_BtAddrStr[18];
#define MAX_HOSTNAME_LEN 63
typedef struct CommsAddrRec {
@ -95,6 +96,7 @@ void comms_getAddr( CommsCtxt* comms, CommsAddrRec* addr );
void comms_setAddr( CommsCtxt* comms, const CommsAddrRec* addr );
CommsConnType comms_getConType( CommsCtxt* comms );
XP_Bool comms_getIsServer( CommsCtxt* comms );
CommsCtxt* comms_makeFromStream( MPFORMAL XWStreamCtxt* stream,
XW_UtilCtxt* util, TransportSend sendproc,

View file

@ -143,7 +143,7 @@ typedef struct UtilVtable {
XP_U16 turn, XP_Bool turnLost );
#ifdef BEYOND_IR
void (*m_util_addrChange)( XW_UtilCtxt* uc, const CommsAddrRec* oldAddr,
const CommsAddrRec* newAddr, XP_Bool isServer );
const CommsAddrRec* newAddr );
#endif
#ifdef XWFEATURE_SEARCHLIMIT
@ -221,8 +221,8 @@ struct XW_UtilCtxt {
(uc)->vtable->m_util_warnIllegalWord((uc),(w),(p),(b))
#ifdef BEYOND_IR
#define util_addrChange( uc, addro, addrn, srvr ) \
(uc)->vtable->m_util_addrChange((uc), (addro), (addrn), (srvr))
#define util_addrChange( uc, addro, addrn ) \
(uc)->vtable->m_util_addrChange((uc), (addro), (addrn))
#endif
#ifdef XWFEATURE_SEARCHLIMIT