MagicQ User Manual
238 / 348
if
(rem->chamsys == ((
’C’
<<24)|(
’R’
<<16)|(
’E’
<<8)|(
’P’
)))
\{
int
len = wswap(rem->length);
remote_ether_bkwd = rem->seq_fwd;
if
(len<(MAX_CREP_MSG-(
sizeof
(remote_ether_mes1)))
\{
if
(len>size) len = size;
memcpy(data,&(rem->data),len);
return
(len);
}
}
}
return
(0);
}
char
remote_ether_tx(
char
*data, word16 size)
\{
// Format the message
byte message[MAX_CREP_MSG];
remote_ether_message_t *rem = (remote_ether_message_t *) message;
int
nbytes;
struct
sockaddr_in name;
if
(!remote_ether_sock)
return
(FALSE);
if
(size>(MAX_CREP_MSG-
sizeof
(remote_ether_mes1))
\{
size = MAX_CREP_MSG-
sizeof
(remote_ether_mes1;
}
rem->chamsys = ((
’C’
<<24)|(
’R’
<<16)|(
’E’
<<8)|(
’P’
));
rem->version = wswap(0);
rem->seq_fwd = remote_ether_fwd;
rem->seq_bkwd = remote_ether_bkwd;
rem->length = wswap(size);