mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-31 08:25:22 +00:00
MDP ping client now shows pings coming in with their transit times.
(no TTLs etc, but hey, it is the first working use of MDP)
This commit is contained in:
parent
61920238d5
commit
aeee2f993c
@ -440,9 +440,11 @@ int app_mdp_ping(int argc,char **argv,struct command_line_option *o)
|
|||||||
for(i=0;i<SID_SIZE;i++) mdp.out.dst.sid[i]=ping_sid[i];
|
for(i=0;i<SID_SIZE;i++) mdp.out.dst.sid[i]=ping_sid[i];
|
||||||
/* Set port to well known echo port (from /etc/services) */
|
/* Set port to well known echo port (from /etc/services) */
|
||||||
mdp.out.dst.port=7;
|
mdp.out.dst.port=7;
|
||||||
mdp.out.payload_length=4;
|
mdp.out.payload_length=4+8;
|
||||||
int *seq=(int *)&mdp.out.payload;
|
int *seq=(int *)&mdp.out.payload;
|
||||||
*seq=sequence_number;
|
*seq=sequence_number;
|
||||||
|
long long *txtime=(long long *)&mdp.out.payload[4];
|
||||||
|
*txtime=overlay_gettime_ms();
|
||||||
|
|
||||||
int res=overlay_mdp_send(&mdp,0,0);
|
int res=overlay_mdp_send(&mdp,0,0);
|
||||||
if (res) {
|
if (res) {
|
||||||
@ -470,6 +472,13 @@ int app_mdp_ping(int argc,char **argv,struct command_line_option *o)
|
|||||||
mdp.error.message,mdp.error.error);
|
mdp.error.message,mdp.error.error);
|
||||||
break;
|
break;
|
||||||
case MDP_RX:
|
case MDP_RX:
|
||||||
|
{
|
||||||
|
int *rxseq=(int *)&mdp.in.payload;
|
||||||
|
long long *txtime=(long long *)&mdp.in.payload[4];
|
||||||
|
printf("%s: seq=%d time=%lld ms\n",
|
||||||
|
overlay_render_sid(mdp.in.src.sid),
|
||||||
|
(*rxseq)-firstSeq,overlay_gettime_ms()-*txtime);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr,"mdpping: overlay_mdp_recv: Unexpected MDP frame type 0x%x\n",mdp.packetTypeAndFlags);
|
fprintf(stderr,"mdpping: overlay_mdp_recv: Unexpected MDP frame type 0x%x\n",mdp.packetTypeAndFlags);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user