IS2: transmit packets to downstream servers

This commit is contained in:
Heikki Hannikainen 2013-07-02 09:05:42 +03:00
parent 50937afbf8
commit ad33ea0eb5
2 changed files with 38 additions and 1 deletions

View File

@ -524,7 +524,25 @@ int is2_deframe_input(struct worker_t *self, struct client_t *c, int start_at)
return i;
}
/*
* Write a packet to a client.
*
* OPTIMIZE: generate packet once, or reuse incoming prepacked buffer
*/
int is2_write_packet(struct worker_t *self, struct client_t *c, char *p, int len)
{
return 0;
ProtobufCBinaryData data;
data.data = (uint8_t *)p;
data.len = len-2;
ISPacket pa = ISPACKET__INIT;
pa.type = ISPACKET__TYPE__IS_PACKET;
pa.is_packet_data = data;
IS2Message m = IS2_MESSAGE__INIT;
m.type = IS2_MESSAGE__TYPE__IS_PACKET;
m.is_packet = &pa;
return is2_write_message(self, c, &m);
}

View File

@ -113,6 +113,23 @@ message KeepalivePing {
optional bytes request_data = 3;
}
/*
* APRS-IS packet
*/
message ISPacket {
enum Type {
// Traditional APRS-IS format with embedded Q construct
IS_PACKET = 2;
}
// Identifies which message is filled in.
required Type type = 1;
// packet data in traditional APRS-IS format, without CRLF
optional bytes is_packet_data = 2;
}
/*
* This is the main link-level container message being transmitted
* between peers (or clients and servers).
@ -129,6 +146,7 @@ message IS2Message {
LOGIN_REQUEST = 3;
LOGIN_REPLY = 4;
KEEPALIVE_PING = 5;
IS_PACKET = 6;
}
// Identifies which message is filled in.
@ -139,5 +157,6 @@ message IS2Message {
optional LoginRequest login_request = 3;
optional LoginReply login_reply = 4;
optional KeepalivePing keepalive_ping = 5;
optional ISPacket is_packet = 6;
}