GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Sending!\n");
struct GNUNET_MessageHeader *hdr = buf;
hdr->size = htons(sizeof(struct GNUNET_MessageHeader));
- hdr->type = htons(GNUNET_MESSAGE_TYPE_SERVICE_UDP);
+ hdr->type = htons(GNUNET_MESSAGE_TYPE_VPN_SERVICE_UDP);
return ntohs(hdr->size);
}
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
const static struct GNUNET_CORE_MessageHandler handlers[] = {
- {&receive, GNUNET_MESSAGE_TYPE_SERVICE_UDP, 0},
+ {&receive, GNUNET_MESSAGE_TYPE_VPN_SERVICE_UDP, 0},
{NULL, 0, 0}
};
/**
* Type of messages containing an UDP packet for a service
*/
-#define GNUNET_MESSAGE_TYPE_SERVICE_UDP 186
+#define GNUNET_MESSAGE_TYPE_VPN_SERVICE_UDP 186
/**
* Type of messages containing an UDP packet from a service
*/
-#define GNUNET_MESSAGE_TYPE_SERVICE_UDP_BACK 187
+#define GNUNET_MESSAGE_TYPE_VPN_SERVICE_UDP_BACK 187
/**
* Type of messages containing an TCP packet for a service
*/
-#define GNUNET_MESSAGE_TYPE_SERVICE_TCP 188
+#define GNUNET_MESSAGE_TYPE_VPN_SERVICE_TCP 188
/**
* Type of messages containing an TCP packet from a service
*/
-#define GNUNET_MESSAGE_TYPE_SERVICE_TCP_BACK 189
+#define GNUNET_MESSAGE_TYPE_VPN_SERVICE_TCP_BACK 189
/**
* Type of messages containing an UDP packet for a remote host
*/
-#define GNUNET_MESSAGE_TYPE_REMOTE_UDP 190
+#define GNUNET_MESSAGE_TYPE_VPN_REMOTE_UDP 190
/**
* Type of messages containing an UDP packet from a remote host
*/
-#define GNUNET_MESSAGE_TYPE_REMOTE_UDP_BACK 191
+#define GNUNET_MESSAGE_TYPE_VPN_REMOTE_UDP_BACK 191
/**
* Type of messages containing an TCP packet for a remote host
*/
-#define GNUNET_MESSAGE_TYPE_REMOTE_TCP 192
+#define GNUNET_MESSAGE_TYPE_VPN_REMOTE_TCP 192
/**
* Type of messages containing an TCP packet from a remote host
*/
-#define GNUNET_MESSAGE_TYPE_REMOTE_TCP_BACK 193
+#define GNUNET_MESSAGE_TYPE_VPN_REMOTE_TCP_BACK 193
/*******************************************************************************
/**
* Type of messages to query the local service-dns
*/
-#define GNUNET_MESSAGE_TYPE_LOCAL_QUERY_DNS 205
+#define GNUNET_MESSAGE_TYPE_VPN_DNS_LOCAL_QUERY_DNS 205
/**
* Type of messages the local service-dns responds with
*/
-#define GNUNET_MESSAGE_TYPE_LOCAL_RESPONSE_DNS 206
+#define GNUNET_MESSAGE_TYPE_VPN_DNS_LOCAL_RESPONSE_DNS 206
/**
* Type of messages to instruct the local service-dns to rehijack the dns
*/
/**
* Type of messages to send a DNS-query to another peer
*/
-#define GNUNET_MESSAGE_TYPE_REMOTE_QUERY_DNS 208
+#define GNUNET_MESSAGE_TYPE_VPN_REMOTE_QUERY_DNS 208
/**
* Type of messages to send a DNS-answer to another peer
*/
-#define GNUNET_MESSAGE_TYPE_REMOTE_ANSWER_DNS 209
+#define GNUNET_MESSAGE_TYPE_VPN_REMOTE_ANSWER_DNS 209
*/
#define GNUNET_MESSAGE_TYPE_PEERINFO_NOTIFY 334
-
+/*******************************************************************************
+ * TODO: we need a way to register message types centrally (via some webpage).
+ * For now: unofficial extensions should start at 48k, internal extensions
+ * define here should leave some room (4-10 additional messages to the previous
+ * extension).
+ ******************************************************************************/
/**
* Type used to match 'all' message types.
*ctunnel = tunnel;
msg = (struct GNUNET_MessageHeader*)(ctunnel + 1);
msg->size = htons (len);
- msg->type = htons (state->type == SERVICE ? GNUNET_MESSAGE_TYPE_SERVICE_UDP_BACK : GNUNET_MESSAGE_TYPE_REMOTE_UDP_BACK);
+ msg->type = htons (state->type == SERVICE ? GNUNET_MESSAGE_TYPE_VPN_SERVICE_UDP_BACK : GNUNET_MESSAGE_TYPE_VPN_REMOTE_UDP_BACK);
GNUNET_HashCode *desc = (GNUNET_HashCode *) (msg + 1);
if (state->type == SERVICE)
memcpy (desc, &state->desc, sizeof (GNUNET_HashCode));
*ctunnel = tunnel;
msg = (struct GNUNET_MessageHeader*)(ctunnel + 1);
msg->size = htons (len);
- msg->type = htons (state->type == SERVICE ? GNUNET_MESSAGE_TYPE_SERVICE_TCP_BACK : GNUNET_MESSAGE_TYPE_REMOTE_TCP_BACK);
+ msg->type = htons (state->type == SERVICE ? GNUNET_MESSAGE_TYPE_VPN_SERVICE_TCP_BACK : GNUNET_MESSAGE_TYPE_VPN_REMOTE_TCP_BACK);
GNUNET_HashCode *desc = (GNUNET_HashCode *) (msg + 1);
if (state->type == SERVICE)
memcpy (desc, &state->desc, sizeof (GNUNET_HashCode));
tcp = GNUNET_CONFIGURATION_get_value_yesno(cfg, "exit", "ENABLE_TCP");
static struct GNUNET_MESH_MessageHandler handlers[] = {
- {receive_udp_service, GNUNET_MESSAGE_TYPE_SERVICE_UDP, 0},
- {receive_tcp_service, GNUNET_MESSAGE_TYPE_SERVICE_TCP, 0},
+ {receive_udp_service, GNUNET_MESSAGE_TYPE_VPN_SERVICE_UDP, 0},
+ {receive_tcp_service, GNUNET_MESSAGE_TYPE_VPN_SERVICE_TCP, 0},
{NULL, 0, 0},
{NULL, 0, 0},
{NULL, 0, 0}
{
handlers[handler_idx].callback = receive_udp_remote;
handlers[handler_idx].expected_size = 0;
- handlers[handler_idx].type = GNUNET_MESSAGE_TYPE_REMOTE_UDP;
+ handlers[handler_idx].type = GNUNET_MESSAGE_TYPE_VPN_REMOTE_UDP;
apptypes[app_idx] = GNUNET_APPLICATION_TYPE_INTERNET_UDP_GATEWAY;
handler_idx++;
app_idx++;
{
handlers[handler_idx].callback = receive_tcp_remote;
handlers[handler_idx].expected_size = 0;
- handlers[handler_idx].type = GNUNET_MESSAGE_TYPE_REMOTE_TCP;
+ handlers[handler_idx].type = GNUNET_MESSAGE_TYPE_VPN_REMOTE_TCP;
apptypes[app_idx] = GNUNET_APPLICATION_TYPE_INTERNET_TCP_GATEWAY;
handler_idx++;
app_idx++;
}
/* the service did something strange, reconnect immediately */
- if (msg->type != htons(GNUNET_MESSAGE_TYPE_LOCAL_RESPONSE_DNS))
+ if (msg->type != htons(GNUNET_MESSAGE_TYPE_VPN_DNS_LOCAL_RESPONSE_DNS))
{
GNUNET_break (0);
GNUNET_CLIENT_disconnect(dns_connection, GNUNET_NO);
|| testBit (me->additional_ports,
ntohs (pkt6_udp->udp_hdr.dpt))))
{
- hdr->type = ntohs (GNUNET_MESSAGE_TYPE_SERVICE_UDP);
+ hdr->type = ntohs (GNUNET_MESSAGE_TYPE_VPN_SERVICE_UDP);
memcpy (hc + 1, &pkt6_udp->udp_hdr,
ntohs (pkt6_udp->udp_hdr.len));
&&
(port_in_ports (me->desc.ports, pkt6_tcp->tcp_hdr.dpt)))
{
- hdr->type = ntohs (GNUNET_MESSAGE_TYPE_SERVICE_TCP);
+ hdr->type = ntohs (GNUNET_MESSAGE_TYPE_VPN_SERVICE_TCP);
memcpy (hc + 1, &pkt6_tcp->tcp_hdr,
ntohs (pkt6->ip6_hdr.paylgth));
s->proto= pkt6->ip6_hdr.nxthdr;
if (s->proto == 0x11)
{
- hdr->type = htons(GNUNET_MESSAGE_TYPE_REMOTE_UDP);
+ hdr->type = htons(GNUNET_MESSAGE_TYPE_VPN_REMOTE_UDP);
memcpy (hc + 1, &pkt6_udp->udp_hdr,
ntohs (pkt6_udp->udp_hdr.len));
app_type = GNUNET_APPLICATION_TYPE_INTERNET_UDP_GATEWAY;
}
else if (s->proto == 0x06)
{
- hdr->type = htons(GNUNET_MESSAGE_TYPE_REMOTE_TCP);
+ hdr->type = htons(GNUNET_MESSAGE_TYPE_VPN_REMOTE_TCP);
memcpy (hc + 1, &pkt6_tcp->tcp_hdr,
ntohs (pkt6->ip6_hdr.paylgth));
app_type = GNUNET_APPLICATION_TYPE_INTERNET_TCP_GATEWAY;
struct query_packet_list *query =
GNUNET_malloc (len + 2 * sizeof (struct query_packet_list *));
- query->pkt.hdr.type = htons (GNUNET_MESSAGE_TYPE_LOCAL_QUERY_DNS);
+ query->pkt.hdr.type = htons (GNUNET_MESSAGE_TYPE_VPN_DNS_LOCAL_QUERY_DNS);
query->pkt.hdr.size = htons (len);
query->pkt.orig_to = pkt->ip_hdr.dadr;
query->pkt.orig_from = pkt->ip_hdr.sadr;
|| testBit (me->additional_ports,
ntohs (pkt_udp->udp_hdr.dpt))))
{
- hdr->type = ntohs (GNUNET_MESSAGE_TYPE_SERVICE_UDP);
+ hdr->type = ntohs (GNUNET_MESSAGE_TYPE_VPN_SERVICE_UDP);
memcpy (hc + 1, &pkt_udp->udp_hdr,
ntohs (pkt_udp->udp_hdr.len));
&&
(port_in_ports (me->desc.ports, pkt_tcp->tcp_hdr.dpt)))
{
- hdr->type = ntohs (GNUNET_MESSAGE_TYPE_SERVICE_TCP);
+ hdr->type = ntohs (GNUNET_MESSAGE_TYPE_VPN_SERVICE_TCP);
memcpy (hc + 1, &pkt_tcp->tcp_hdr,
ntohs (pkt->ip_hdr.tot_lngth) - 4*pkt->ip_hdr.hdr_lngth);
s->proto= pkt->ip_hdr.proto;
if (s->proto == 0x11)
{
- hdr->type = htons(GNUNET_MESSAGE_TYPE_REMOTE_UDP);
+ hdr->type = htons(GNUNET_MESSAGE_TYPE_VPN_REMOTE_UDP);
memcpy (hc + 1, &pkt_udp->udp_hdr,
ntohs (pkt_udp->udp_hdr.len));
app_type = GNUNET_APPLICATION_TYPE_INTERNET_UDP_GATEWAY;
}
else if (s->proto == 0x06)
{
- hdr->type = htons(GNUNET_MESSAGE_TYPE_REMOTE_TCP);
+ hdr->type = htons(GNUNET_MESSAGE_TYPE_VPN_REMOTE_TCP);
memcpy (hc + 1, &pkt_tcp->tcp_hdr,
ntohs (pkt->ip_hdr.tot_lngth) - 4*pkt->ip_hdr.hdr_lngth);
app_type = GNUNET_APPLICATION_TYPE_INTERNET_TCP_GATEWAY;
GNUNET_assert (pkt6 != NULL);
- if (ntohs (message->type) == GNUNET_MESSAGE_TYPE_SERVICE_UDP_BACK)
+ if (ntohs (message->type) == GNUNET_MESSAGE_TYPE_VPN_SERVICE_UDP_BACK)
new_ip6addr (pkt6->ip6_hdr.sadr, &other->hashPubKey, desc);
else
new_ip6addr_remote (pkt6->ip6_hdr.sadr, s->addr, s->addrlen);
GNUNET_free (key);
GNUNET_assert (me != NULL);
- if (ntohs (message->type) == GNUNET_MESSAGE_TYPE_SERVICE_UDP_BACK)
+ if (ntohs (message->type) == GNUNET_MESSAGE_TYPE_VPN_SERVICE_UDP_BACK)
{
GNUNET_assert (me->desc.
service_type & htonl (GNUNET_DNS_SERVICE_TYPE_UDP));
GNUNET_assert (pkt4 != NULL);
- GNUNET_assert (ntohs (message->type) == GNUNET_MESSAGE_TYPE_REMOTE_UDP_BACK);
+ GNUNET_assert (ntohs (message->type) == GNUNET_MESSAGE_TYPE_VPN_REMOTE_UDP_BACK);
uint32_t sadr;
new_ip4addr_remote ((unsigned char*)&sadr, s->addr, s->addrlen);
pkt4->ip_hdr.sadr = sadr;
GNUNET_assert (pkt6 != NULL);
- if (ntohs (message->type) == GNUNET_MESSAGE_TYPE_SERVICE_TCP_BACK)
+ if (ntohs (message->type) == GNUNET_MESSAGE_TYPE_VPN_SERVICE_TCP_BACK)
new_ip6addr (pkt6->ip6_hdr.sadr, &other->hashPubKey, desc);
else
new_ip6addr_remote (pkt6->ip6_hdr.sadr, s->addr, s->addrlen);
GNUNET_free (key);
GNUNET_assert (me != NULL);
- if (ntohs (message->type) == GNUNET_MESSAGE_TYPE_SERVICE_UDP_BACK)
+ if (ntohs (message->type) == GNUNET_MESSAGE_TYPE_VPN_SERVICE_UDP_BACK)
GNUNET_assert (me->desc.
service_type & htonl (GNUNET_DNS_SERVICE_TYPE_TCP));
GNUNET_assert (pkt4 != NULL);
memset (pkt4, 0, size);
- GNUNET_assert (ntohs (message->type) == GNUNET_MESSAGE_TYPE_REMOTE_TCP_BACK);
+ GNUNET_assert (ntohs (message->type) == GNUNET_MESSAGE_TYPE_VPN_REMOTE_TCP_BACK);
uint32_t sadr;
new_ip4addr_remote ((unsigned char*)&sadr, s->addr, s->addrlen);
pkt4->ip_hdr.sadr = sadr;
const struct GNUNET_CONFIGURATION_Handle *cfg_)
{
static const struct GNUNET_MESH_MessageHandler handlers[] = {
- {receive_udp_back, GNUNET_MESSAGE_TYPE_SERVICE_UDP_BACK, 0},
- {receive_tcp_back, GNUNET_MESSAGE_TYPE_SERVICE_TCP_BACK, 0},
- {receive_udp_back, GNUNET_MESSAGE_TYPE_REMOTE_UDP_BACK, 0},
- {receive_tcp_back, GNUNET_MESSAGE_TYPE_REMOTE_TCP_BACK, 0},
+ {receive_udp_back, GNUNET_MESSAGE_TYPE_VPN_SERVICE_UDP_BACK, 0},
+ {receive_tcp_back, GNUNET_MESSAGE_TYPE_VPN_SERVICE_TCP_BACK, 0},
+ {receive_udp_back, GNUNET_MESSAGE_TYPE_VPN_REMOTE_UDP_BACK, 0},
+ {receive_tcp_back, GNUNET_MESSAGE_TYPE_VPN_REMOTE_TCP_BACK, 0},
{NULL, 0, 0}
};
uint32_t *sz = cls;
struct GNUNET_MESH_Tunnel **tunnel = (struct GNUNET_MESH_Tunnel**)(sz+1);
struct dns_pkt *dns = (struct dns_pkt *) (tunnel + 1);
- hdr->type = htons (GNUNET_MESSAGE_TYPE_REMOTE_ANSWER_DNS);
+ hdr->type = htons (GNUNET_MESSAGE_TYPE_VPN_REMOTE_ANSWER_DNS);
hdr->size = htons (*sz + sizeof (struct GNUNET_MessageHeader));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
GNUNET_malloc (len + 2 * sizeof (struct answer_packet_list *));
memset (answer, 0, len + 2 * sizeof (struct answer_packet_list *));
- answer->pkt.hdr.type = htons (GNUNET_MESSAGE_TYPE_LOCAL_RESPONSE_DNS);
+ answer->pkt.hdr.type = htons (GNUNET_MESSAGE_TYPE_VPN_DNS_LOCAL_RESPONSE_DNS);
answer->pkt.hdr.size = htons (len);
struct dns_pkt_parsed* pdns = parse_dns_packet(dns);
struct answer_packet_list* answer = GNUNET_malloc(len + 2*sizeof(struct answer_packet_list*));
memset(answer, 0, len + 2*sizeof(struct answer_packet_list*));
- answer->pkt.hdr.type = htons(GNUNET_MESSAGE_TYPE_LOCAL_RESPONSE_DNS);
+ answer->pkt.hdr.type = htons(GNUNET_MESSAGE_TYPE_VPN_DNS_LOCAL_RESPONSE_DNS);
answer->pkt.hdr.size = htons(len);
answer->pkt.subtype = GNUNET_DNS_ANSWER_TYPE_REV;
struct answer_packet_list* answer = GNUNET_malloc(len + 2*sizeof(struct answer_packet_list*));
memset(answer, 0, len + 2*sizeof(struct answer_packet_list*));
- answer->pkt.hdr.type = htons(GNUNET_MESSAGE_TYPE_LOCAL_RESPONSE_DNS);
+ answer->pkt.hdr.type = htons(GNUNET_MESSAGE_TYPE_VPN_DNS_LOCAL_RESPONSE_DNS);
answer->pkt.hdr.size = htons(len);
answer->pkt.subtype = GNUNET_DNS_ANSWER_TYPE_SERVICE;
struct tunnel_cls *cls_ = GNUNET_malloc(size);
cls_->hdr.size = size - sizeof(struct GNUNET_MESH_Tunnel*);
- cls_->hdr.type = ntohs(GNUNET_MESSAGE_TYPE_REMOTE_QUERY_DNS);
+ cls_->hdr.type = ntohs(GNUNET_MESSAGE_TYPE_VPN_REMOTE_QUERY_DNS);
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "size: %d\n", size);
memcpy(&cls_->dns, dns, cls_->hdr.size - sizeof(struct GNUNET_MessageHeader));
struct answer_packet_list *answer =
GNUNET_malloc (len + 2 * sizeof (struct answer_packet_list *));
answer->pkt.hdr.type =
- htons (GNUNET_MESSAGE_TYPE_LOCAL_RESPONSE_DNS);
+ htons (GNUNET_MESSAGE_TYPE_VPN_DNS_LOCAL_RESPONSE_DNS);
answer->pkt.hdr.size = htons (len);
answer->pkt.subtype = GNUNET_DNS_ANSWER_TYPE_IP;
answer->pkt.from = addr.sin_addr.s_addr;
{
static const struct GNUNET_SERVER_MessageHandler handlers[] = {
/* callback, cls, type, size */
- {&receive_query, NULL, GNUNET_MESSAGE_TYPE_LOCAL_QUERY_DNS, 0},
+ {&receive_query, NULL, GNUNET_MESSAGE_TYPE_VPN_DNS_LOCAL_QUERY_DNS, 0},
{&rehijack, NULL, GNUNET_MESSAGE_TYPE_REHIJACK,
sizeof (struct GNUNET_MessageHeader)},
{NULL, NULL, 0, 0}
};
static const struct GNUNET_MESH_MessageHandler mesh_handlers[] = {
- {receive_mesh_query, GNUNET_MESSAGE_TYPE_REMOTE_QUERY_DNS, 0},
- {receive_mesh_answer, GNUNET_MESSAGE_TYPE_REMOTE_ANSWER_DNS, 0},
+ {receive_mesh_query, GNUNET_MESSAGE_TYPE_VPN_REMOTE_QUERY_DNS, 0},
+ {receive_mesh_answer, GNUNET_MESSAGE_TYPE_VPN_REMOTE_ANSWER_DNS, 0},
{NULL, 0, 0}
};