memcpy(&msg->rootdelay.int_part, p, sizeof(msg->rootdelay.int_part)); p += sizeof(msg->rootdelay.int_part); memcpy(&msg->rootdelay.fraction, p, sizeof(msg->rootdelay.fraction)); p += sizeof(msg->rootdelay.fraction); memcpy(&msg->dispersion.int_part, p, sizeof(msg->dispersion.int_part)); p += sizeof(msg->dispersion.int_part); memcpy(&msg->dispersion.fraction, p, sizeof(msg->dispersion.fraction)); p += sizeof(msg->dispersion.fraction);
memcpy(&msg->rootdelay.int_parts, p, sizeof(msg->rootdelay.int_parts)); p += sizeof(msg->rootdelay.int_parts); memcpy(&msg->rootdelay.fractions, p, sizeof(msg->rootdelay.fractions)); p += sizeof(msg->rootdelay.fractions); memcpy(&msg->dispersion.int_parts, p, sizeof(msg->dispersion.int_parts)); p += sizeof(msg->dispersion.int_parts); memcpy(&msg->dispersion.fractions, p, sizeof(msg->dispersion.fractions)); p += sizeof(msg->dispersion.fractions);
ntp_getmsg(char *p, ssize_t len, struct ntp_msg *msg){	if (len != NTP_MSGSIZE_NOAUTH && len != NTP_MSGSIZE) {		log_warnx("malformed packet received");		return (-1);	}	memcpy(&msg->status, p, sizeof(msg->status));	p += sizeof(msg->status);	memcpy(&msg->stratum, p, sizeof(msg->stratum));	p += sizeof(msg->stratum);	memcpy(&msg->ppoll, p, sizeof(msg->ppoll));	p += sizeof(msg->ppoll);	memcpy(&msg->precision, p, sizeof(msg->precision));	p += sizeof(msg->precision);	memcpy(&msg->rootdelay.int_part, p, sizeof(msg->rootdelay.int_part));	p += sizeof(msg->rootdelay.int_part);	memcpy(&msg->rootdelay.fraction, p, sizeof(msg->rootdelay.fraction));	p += sizeof(msg->rootdelay.fraction);	memcpy(&msg->dispersion.int_part, p, sizeof(msg->dispersion.int_part));	p += sizeof(msg->dispersion.int_part);	memcpy(&msg->dispersion.fraction, p, sizeof(msg->dispersion.fraction));	p += sizeof(msg->dispersion.fraction);	memcpy(&msg->refid, p, sizeof(msg->refid));	p += sizeof(msg->refid);	memcpy(&msg->reftime.int_part, p, sizeof(msg->reftime.int_part));	p += sizeof(msg->reftime.int_part);	memcpy(&msg->reftime.fraction, p, sizeof(msg->reftime.fraction));	p += sizeof(msg->reftime.fraction);	memcpy(&msg->orgtime.int_part, p, sizeof(msg->orgtime.int_part));	p += sizeof(msg->orgtime.int_part);	memcpy(&msg->orgtime.fraction, p, sizeof(msg->orgtime.fraction));	p += sizeof(msg->orgtime.fraction);	memcpy(&msg->rectime.int_part, p, sizeof(msg->rectime.int_part));	p += sizeof(msg->rectime.int_part);	memcpy(&msg->rectime.fraction, p, sizeof(msg->rectime.fraction));	p += sizeof(msg->rectime.fraction);	memcpy(&msg->xmttime.int_part, p, sizeof(msg->xmttime.int_part));	p += sizeof(msg->xmttime.int_part);	memcpy(&msg->xmttime.fraction, p, sizeof(msg->xmttime.fraction));	p += sizeof(msg->xmttime.fraction);	return (0);}