A stack which works with or without an Mbed os library. Provides IPv4 or IPv6 with a full 1500 byte buffer.

Dependents:   oldheating gps motorhome heating

net.h

Committer:
andrewboyson
Date:
2017-07-03
Revision:
22:914b970356f0
Parent:
15:6ca6778168b1
Child:
37:793b39683406

File content as of revision 22:914b970356f0:

#pragma once
#include "mbed.h"

extern  int16_t NetToHost16(int16_t n);
extern  int32_t NetToHost32(int32_t n);
extern  int64_t NetToHost64(int64_t n);
extern uint16_t NetCheckSum(int count, void* pData);
extern uint16_t NetCheckSumTwo(int count1, void* pData1, int count2, void* pData2);

extern int NetInit(char* name);
extern int NetMain();

extern char* NetName;

struct NetAction
{
    char dst; //none, reply, specified, dns, dhcp, all nodes, all routers, mdns, llmnr,
    char cst; //none, unicast, multicast, broadcast, solicited
    char pro; //none, IPv4 or IPv6
    char dbg; //false or true
};

#define NET_DO_NOTHING  0
#define NET_REPLY       1
#define NET_SPECIFIED   2
#define NET_ALL_NODES   3
#define NET_ALL_ROUTERS 4
#define NET_DNS         5
#define NET_MDNS        6
#define NET_LLMNR       7
#define NET_DHCP        8

#define NET_UNICAST     1
#define NET_MULTICAST   2
#define NET_SOLICITED   3
#define NET_BROADCAST   4


#define DO_NOTHING       0
#define   UNICAST        1
#define   UNICAST_DNS    2
#define   UNICAST_DHCP   3
#define   UNICAST_NTP    4
#define MULTICAST_NODE   5
#define MULTICAST_ROUTER 6
#define MULTICAST_MDNS   7
#define MULTICAST_LLMNR  8
#define SOLICITED_NODE   9
#define BROADCAST       10