Initial release:
[firmerware] / include / 0cpm / netfun.h
1
2 enum mem_netinput {
3         //
4         // Pointers to recognised structures
5         MEM_ETHER_HEAD,
6         MEM_ETHER_PLOAD,
7         MEM_ARP_HEAD,
8         MEM_IP4_HEAD,
9         MEM_IP4_PLOAD,
10         MEM_ICMP4_HEAD,
11         MEM_DHCP4_HEAD,
12         MEM_UDP4_HEAD,
13         MEM_UDP4_PLOAD,
14         MEM_6BED4_PLOAD,
15         MEM_IP6_HEAD,
16         MEM_IP6_PLOAD,
17         MEM_ICMP6_HEAD,
18         MEM_UDP6_HEAD,
19         MEM_UDP6_PLOAD,
20         MEM_RTP_HEAD,
21         MEM_RTCP_HEAD,
22         MEM_DHCP6_HEAD,
23         MEM_DNS_HEAD,
24         MEM_DNSSD_HEAD,
25         MEM_SIP_HEAD,
26         //
27         // Pointer to the first bit outside the packet
28         MEM_ALL_DONE,
29         //
30         // Miscellaneous data from the parsed packets
31         MEM_IP4_SRC,
32         MEM_IP4_DST,
33         MEM_ETHER_SRC,
34         MEM_ETHER_DST,
35         MEM_UDP4_PORTS,
36         MEM_UDP6_PORTS,
37         MEM_VLAN_ID,
38         MEM_BINDING6,
39         MEM_IP6_DST,
40         //
41         // The number of entries in this enum
42         MEM_NETVAR_COUNT
43 };
44
45 #include <linux/if_tun.h>
46 struct tunbuf {
47         struct tun_pi prefix;
48         uint8_t data [1500 + 18];
49 };
50
51
52
53 uint16_t netcore_checksum_areas (void *area0, ...);
54 int netcore_send_buffer (int tunsox, uint32_t *mem, struct tunbuf *wbuf);
55
56 uint8_t *net_arp_reply (uint8_t *pkt, uint32_t pktlen, uint32_t *mem);
57 uint8_t *net_dhcp4 (uint8_t *pkt, uint32_t pktlen, uint32_t *mem);
58 uint8_t *net_rtp (uint8_t *pkt, uint32_t pktlen, uint32_t *mem);
59 uint8_t *net_rtcp (uint8_t *pkt, uint32_t pktlen, uint32_t *mem);
60 uint8_t *net_sip (uint8_t *pkt, uint32_t pktlen, uint32_t *mem);
61 uint8_t *net_mdns_resp_error (uint8_t *pkt, uint32_t pktlen, uint32_t *mem);
62 uint8_t *net_mdns_resp_dyn (uint8_t *pkt, uint32_t pktlen, uint32_t *mem);
63 uint8_t *net_mdns_resp_std (uint8_t *pkt, uint32_t pktlen, uint32_t *mem);
64 uint8_t *net_mdns_query_error (uint8_t *pkt, uint32_t pktlen, uint32_t *mem);
65 uint8_t *net_mdns_query_ok (uint8_t *pkt, uint32_t pktlen, uint32_t *mem);
66
67 uint8_t *netreply_arp_query (uint8_t *pkt, uint32_t *mem);
68 uint8_t *netreply_icmp4_echo_req (uint8_t *pkt, uint32_t *mem);
69 uint8_t *netreply_icmp6_ngb_disc (uint8_t *pkt, uint32_t *mem);
70 uint8_t *netreply_icmp6_echo_req (uint8_t *pkt, uint32_t *mem);
71 uint8_t *netreply_dhcp4_offer (uint8_t *pkt, uint32_t *mem);
72 uint8_t *netreply_dhcp6_advertise (uint8_t *pout, uint32_t *mem);
73
74 uint8_t *netsend_icmp6_router_solicit (uint8_t *pout, uint32_t *mem);
75 uint8_t *netsend_icmp6_ngb_sol (uint8_t *pout, uint32_t *mem);
76 uint8_t *netsend_dhcp4_discover (uint8_t *pout, uint32_t *mem);
77 uint8_t *netsend_dhcp6_solicit (uint8_t *pout, uint32_t *mem);
78
79 uint8_t *netdb_router_advertised (uint8_t *pout, uint32_t *mem);
80 uint8_t *netdb_neighbour_advertised (uint8_t *pout, uint32_t *mem);
81 uint8_t *netdb_dhcp4_ack (uint8_t *pout, uint32_t *mem);
82 uint8_t *netdb_dhcp4_nak (uint8_t *pout, uint32_t *mem);
83 uint8_t *netdb_dhcp6_reply (uint8_t *pout, uint32_t *mem);
84 uint8_t *netdb_dhcp6_reconfigure (uint8_t *pout, uint32_t *mem);
85
86 uint8_t *netout (uint8_t *pkt, uint32_t pktlen, uint32_t *mem);