1 : /*
2 : * packets.h - helpers to send Teredo packet
3 : * $Id: packets.h 1938 2007-02-22 20:55:28Z remi $
4 : *
5 : * See "Teredo: Tunneling IPv6 over UDP through NATs"
6 : * for more information
7 : */
8 :
9 : /***********************************************************************
10 : * Copyright © 2004-2007 Rémi Denis-Courmont. *
11 : * This program is free software; you can redistribute and/or modify *
12 : * it under the terms of the GNU General Public License as published *
13 : * by the Free Software Foundation; version 2 of the license. *
14 : * *
15 : * This program is distributed in the hope that it will be useful, *
16 : * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
18 : * See the GNU General Public License for more details. *
19 : * *
20 : * You should have received a copy of the GNU General Public License *
21 : * along with this program; if not, you can get it from: *
22 : * http://www.gnu.org/copyleft/gpl.html *
23 : ***********************************************************************/
24 :
25 : #ifndef LIBTEREDO_TEREDO_PACKETS_H
26 : # define LIBTEREDO_TEREDO_PACKETS_H
27 :
28 : struct in6_addr;
29 : struct ip6_hdr;
30 : struct icmp6_hdr;
31 :
32 : # ifdef __cplusplus
33 : extern "C" {
34 : #endif
35 :
36 : int teredo_parse_ra (const teredo_packet *restrict packet,
37 : union teredo_addr *restrict newaddr,
38 : bool cone, uint16_t *restrict mtu);
39 :
40 : int CheckPing (const teredo_packet *packet);
41 : int CheckBubble (const teredo_packet *packet);
42 :
43 :
44 : int SendBubbleFromDst (int fd, const struct in6_addr *dst, bool indirect);
45 : int teredo_send_bubble (int fd, uint32_t ip, uint16_t port,
46 : const uint8_t *src, const uint8_t *dst);
47 :
48 : static inline int teredo_reply_bubble (int fd, uint32_t ip, uint16_t port,
49 : const uint8_t *req)
50 0 : {
51 0 : return teredo_send_bubble (fd, ip, port, req + 8 + 16, req + 8);
52 : }
53 :
54 : int teredo_send_rs (int fd, uint32_t server_ip,
55 : const unsigned char *nonce, bool cone);
56 :
57 : int SendPing (int fd, const union teredo_addr *src,
58 : const struct in6_addr *dst);
59 :
60 : int BuildICMPv6Error (struct icmp6_hdr *restrict out, uint8_t type,
61 : uint8_t code, const void *restrict in, size_t inlen);
62 :
63 : # if 0
64 : int BuildIPv6Error (struct ip6_hdr *out, const struct in6_addr *src,
65 : uint8_t type, uint8_t code, const void *in, uint16_t len);
66 : #endif
67 :
68 : # ifdef __cplusplus
69 : }
70 : #endif
71 :
72 :
73 : #endif
|