bsdsocket.library SBTC_GET_BYTES_RECEIVED and SBTC_GET_BYTES_SENT.

This commit is contained in:
Toni Wilen 2020-10-10 17:10:22 +03:00
parent e09fc7f663
commit 314eab64b7
3 changed files with 20 additions and 0 deletions

View File

@ -1433,6 +1433,8 @@ static uae_u32 strErrptr, strReleaseVer;
#define SBTC_ERRNOLONGPTR 24
#define SBTC_HERRNOLONGPTR 25
#define SBTC_RELEASESTRPTR 29
#define SBTC_GET_BYTES_RECEIVED 64
#define SBTC_GET_BYTES_SENT 65
#define LOG_FACMASK 0x03f8
@ -1684,6 +1686,21 @@ static uae_u32 REGPARAM2 bsdsocklib_SocketBaseTagList(TrapContext *ctx)
tagcopy(ctx, currtag, currval, tagptr, &strReleaseVer);
}
break;
case SBTC_GET_BYTES_RECEIVED:
BSDTRACE ((_T("SBTC_GET_BYTES_RECEIVED),%08x"), currval));
if ((currtag & 0x8001) == 0x8000) { /* SBTM_GETREF */
trap_put_long(ctx, currval + 0, sb->bytesreceived >> 32);
trap_put_long(ctx, currval + 4, sb->bytesreceived >> 0);
}
break;
case SBTC_GET_BYTES_SENT:
BSDTRACE ((_T("SBTC_GET_BYTES_SENT),%08x"), currval));
if ((currtag & 0x8001) == 0x8000) { /* SBTM_GETREF */
trap_put_long(ctx, currval + 0, sb->bytestransmitted >> 32);
trap_put_long(ctx, currval + 4, sb->bytestransmitted >> 0);
}
break;
default:
write_log (_T("bsdsocket: WARNING: Unsupported tag type (%08x=%d) in SocketBaseTagList(%x)\n"),
currtag, (currtag / 2) & SBTS_CODE, trap_get_areg(ctx, 0));

View File

@ -69,6 +69,7 @@ struct socketbase {
uae_u32 logmask;
uae_u32 logfacility;
uaecptr fdcallback;
uae_u64 bytestransmitted, bytesreceived;
unsigned int *mtable; /* window messages allocated for asynchronous event notification */
/* host-specific fields below */

View File

@ -1215,6 +1215,7 @@ void host_sendto (TrapContext *ctx, SB, uae_u32 sd, uae_u32 msg, uae_u8 *hmsg, u
} else {
realpt += sb->resultval;
len -= sb->resultval;
sb->bytestransmitted += sb->resultval;
if (len <= 0)
break;
else
@ -1323,6 +1324,7 @@ void host_recvfrom(TrapContext *ctx, SB, uae_u32 sd, uae_u32 msg, uae_u8 *hmsg,
int l = sb->resultval;
realpt += l;
len -= l;
sb->bytesreceived += l;
waitallgot += l;
if (len <= 0) {
sb->resultval = waitallgot;