36 lines
906 B
C++
36 lines
906 B
C++
#include "coppino.h"
|
|
#include "ipv6.h"
|
|
#include "slip.h"
|
|
|
|
void setup() {
|
|
pinMode(13, OUTPUT);
|
|
|
|
Serial.begin(9600);
|
|
char addr[16] = { 0x20, 0x01, 0x04, 0x70, 0xc8, 0x44, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xca, 0xfe};
|
|
coppino::address.deserialize(addr);
|
|
}
|
|
|
|
void loop() {
|
|
|
|
/* some UDP stuff, just to test */
|
|
char udp_packet[64];
|
|
memcpy(udp_packet, "\x00\x00\x77\x77\x00\x12\x00\x00helloworld", 18);
|
|
|
|
ipv6::IPv6Packet ip_packet;
|
|
|
|
ip_packet.setPayload(udp_packet, 18);
|
|
ip_packet.setSrcAddress(coppino::address);
|
|
|
|
// ipv6::IPv6Addr dst_addr("\x20\x01\x04\x70\xc8\x44\x00\x30\x53\x47\xde\x2d\x41\xb1\x5b\x8c");
|
|
ipv6::IPv6Addr dst_addr("\x20\x01\x04\x70\xc8\x44\x00\x31\x00\x00\x00\x00\x00\x00\x00\x01");
|
|
ip_packet.setDstAddress(dst_addr);
|
|
|
|
ip_packet.setNextHeader(17); // UDP
|
|
|
|
// slip::send(ip_packet.serialize(), 18 + 40);
|
|
|
|
coppino::handler();
|
|
|
|
//delay(5000);
|
|
}
|