diff options
| author | Miguel <m.i@gmx.at> | 2018-09-26 10:22:37 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2018-09-26 10:22:37 +0200 |
| commit | ae33cc6557790a502a01b380b0926944ca2f3cfa (patch) | |
| tree | e72632052d1c6f6830c40d10d26c04b73aac74c6 /net/udp.c | |
| parent | daf374435560861681c3e4d14a2d44141aa11abc (diff) | |
ntp and udp
Diffstat (limited to 'net/udp.c')
| -rw-r--r-- | net/udp.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/net/udp.c b/net/udp.c new file mode 100644 index 0000000..6913256 --- /dev/null +++ b/net/udp.c @@ -0,0 +1,16 @@ +#include "udp.h" +#include "inet.h" +#include "ipv4.h" + +uint32_t udp_generic(struct netdev *dev, uint32_t ip, uint16_t src, uint16_t dst, uint8_t* pos,uint8_t *end) +{ + pos-=8; //we need 64 bytes + struct udp_v4 *udp=pos; + + udp->src_port=htons(src); + udp->dst_port=htons(dst); + udp->len=htons(end-pos); + udp->csum=0; // TODO: optional + + return ipv4_generic(dev,ip,IPV4_P_UDP,pos,end); +} |
