diff --git a/src/aprsis2.c b/src/aprsis2.c index 30867b9..6bbbf37 100644 --- a/src/aprsis2.c +++ b/src/aprsis2.c @@ -68,7 +68,7 @@ static int is2_write_message(struct worker_t *self, struct client_t *c, IS2Messa int is2_out_server_signature(struct worker_t *self, struct client_t *c) { - ServerSignature sig = SERVER_SIGNATURE__INIT; + IS2ServerSignature sig = IS2_SERVER_SIGNATURE__INIT; sig.username = serverid; sig.app_name = verstr_progname; sig.app_version = version_build; @@ -86,9 +86,9 @@ int is2_out_server_signature(struct worker_t *self, struct client_t *c) * Transmit a login reply to a new client */ -int is2_out_login_reply(struct worker_t *self, struct client_t *c, LoginReply__LoginResult result, LoginReply__LoginResultReason reason, VerificationStatus verified) +int is2_out_login_reply(struct worker_t *self, struct client_t *c, IS2LoginReply__LoginResult result, IS2LoginReply__LoginResultReason reason, VerificationStatus verified) { - LoginReply lr = LOGIN_REPLY__INIT; + IS2LoginReply lr = IS2_LOGIN_REPLY__INIT; lr.result = result; lr.result_code = reason; lr.verified = verified; @@ -106,7 +106,7 @@ int is2_out_login_reply(struct worker_t *self, struct client_t *c, LoginReply__L static int is2_in_login_reply(struct worker_t *self, struct client_t *c, IS2Message *m) { - LoginReply *lr = m->login_reply; + IS2LoginReply *lr = m->login_reply; if (!lr) { hlog(LOG_WARNING, "%s/%s: IS2: unpacking of login reply failed", c->addr_rem, c->username); @@ -137,7 +137,7 @@ static int is2_in_login_reply(struct worker_t *self, struct client_t *c, IS2Mess static int is2_in_server_signature(struct worker_t *self, struct client_t *c, IS2Message *m) { - ServerSignature *sig = m->server_signature; + IS2ServerSignature *sig = m->server_signature; if (!sig) { hlog(LOG_WARNING, "%s/%s: IS2: unpacking of server signature failed", c->addr_rem, c->username); @@ -174,7 +174,7 @@ static int is2_in_server_signature(struct worker_t *self, struct client_t *c, IS #endif /* Ok, we're happy with the uplink's server signature, let us login! */ - LoginRequest lr = LOGIN_REQUEST__INIT; + IS2LoginRequest lr = IS2_LOGIN_REQUEST__INIT; lr.username = serverid; lr.app_name = verstr_progname; lr.app_version = version_build; @@ -233,7 +233,7 @@ static int is2_in_login_request(struct worker_t *self, struct client_t *c, IS2Me { int rc = 0; - LoginRequest *lr = m->login_request; + IS2LoginRequest *lr = m->login_request; if (!lr) { hlog(LOG_WARNING, "%s/%s: IS2: unpacking of login request failed", c->addr_rem, c->username); @@ -351,7 +351,7 @@ static int is2_in_login_request(struct worker_t *self, struct client_t *c, IS2Me } /* tell the client he's good */ - is2_out_login_reply(self, c, LOGIN_REPLY__LOGIN_RESULT__OK, LOGIN_REPLY__LOGIN_RESULT_REASON__NONE, vs); + is2_out_login_reply(self, c, IS2_LOGIN_REPLY__LOGIN_RESULT__OK, IS2_LOGIN_REPLY__LOGIN_RESULT_REASON__NONE, vs); /* mark as connected and classify */ worker_mark_client_connected(self, c); @@ -434,8 +434,8 @@ int is2_out_ping(struct worker_t *self, struct client_t *c) rdata.data = NULL; rdata.len = 0; - KeepalivePing ping = KEEPALIVE_PING__INIT; - ping.ping_type = KEEPALIVE_PING__PING_TYPE__REQUEST; + IS2KeepalivePing ping = IS2_KEEPALIVE_PING__INIT; + ping.ping_type = IS2_KEEPALIVE_PING__PING_TYPE__REQUEST; ping.request_id = random(); ping.request_data = rdata; @@ -454,7 +454,7 @@ static int is2_in_ping(struct worker_t *self, struct client_t *c, IS2Message *m) { int r = 0; - KeepalivePing *ping = m->keepalive_ping; + IS2KeepalivePing *ping = m->keepalive_ping; if (!ping) { hlog(LOG_WARNING, "%s/%s: IS2: unpacking of ping failed", c->addr_rem, c->username); @@ -464,11 +464,11 @@ static int is2_in_ping(struct worker_t *self, struct client_t *c, IS2Message *m) hlog(LOG_DEBUG, "%s/%s: IS2: Ping %s received: request_id %lu", c->addr_rem, c->username, - (ping->ping_type == KEEPALIVE_PING__PING_TYPE__REQUEST) ? "Request" : "Reply", + (ping->ping_type == IS2_KEEPALIVE_PING__PING_TYPE__REQUEST) ? "Request" : "Reply", ping->request_id); - if (ping->ping_type == KEEPALIVE_PING__PING_TYPE__REQUEST) { - ping->ping_type = KEEPALIVE_PING__PING_TYPE__REPLY; + if (ping->ping_type == IS2_KEEPALIVE_PING__PING_TYPE__REQUEST) { + ping->ping_type = IS2_KEEPALIVE_PING__PING_TYPE__REPLY; r = is2_write_message(self, c, m); } diff --git a/src/aprsis2.proto b/src/aprsis2.proto index d055867..0b3bc7d 100644 --- a/src/aprsis2.proto +++ b/src/aprsis2.proto @@ -1,13 +1,13 @@ // -// A server sends a ServerSignature to all new clients. +// A server sends an IS2ServerSignature to all new clients. // // Future expansion space: the server may signal support for // optional future extensions by providing a list of string IDs // of supported features. // -message ServerSignature { +message IS2ServerSignature { required string username = 1; // callsign-SSID required string app_name = 2; required string app_version = 3; @@ -15,14 +15,14 @@ message ServerSignature { } // -// Clients can then request a login with a LoginRequest. +// Clients can then request a login with a IS2LoginRequest. // // features_req contains a list of features the client would like // to enable for the connection (may only contain features // listed supported by the server). // -message LoginRequest { +message IS2LoginRequest { required string username = 1; // callsign-SSID optional string password = 2; // passcode or password required string app_name = 3; @@ -45,7 +45,7 @@ enum VerificationStatus { } // -// Server replies to a LoginRequest with a LoginReply. +// Server replies to a IS2LoginRequest with a IS2LoginReply. // // features_ack contains a list of optional features accepted // by the server (may only contain features requested in features_req). @@ -53,7 +53,7 @@ enum VerificationStatus { // even if it would technically support them. // -message LoginReply { +message IS2LoginReply { enum LoginResult { FAIL = 0; // Login rejected, the client will be thrown out OK = 1; @@ -102,7 +102,7 @@ message LoginReply { // whichever convenient local format and accuracy. // -message KeepalivePing { +message IS2KeepalivePing { enum PingType { REQUEST = 1; REPLY = 2; @@ -196,10 +196,10 @@ message IS2Message { optional bytes signature = 3; // One of the following will be filled in. Just one. - optional ServerSignature server_signature = 21; - optional LoginRequest login_request = 22; - optional LoginReply login_reply = 23; - optional KeepalivePing keepalive_ping = 24; + optional IS2ServerSignature server_signature = 21; + optional IS2LoginRequest login_request = 22; + optional IS2LoginReply login_reply = 23; + optional IS2KeepalivePing keepalive_ping = 24; repeated ISPacket is_packet = 25; optional IS2Parameter parameter = 26; } diff --git a/tests/libperl/Ham/APRS/IS2.pm b/tests/libperl/Ham/APRS/IS2.pm index 21fdf88..2b65ae4 100644 --- a/tests/libperl/Ham/APRS/IS2.pm +++ b/tests/libperl/Ham/APRS/IS2.pm @@ -203,7 +203,7 @@ sub connect($;%) } # send login request - my $lm = LoginRequest->new({ + my $lm = IS2LoginRequest->new({ 'username' => $self->{'mycall'}, 'password' => $self->{'aprspass'}, 'app_name' => $aprs_appname, @@ -232,7 +232,7 @@ sub connect($;%) # defined $rep->result_code ? $rep->result_code : 0, # defined $rep->result_message ? $rep->result_message : ''); - if ($rep->result != LoginReply::LoginResult::OK()) { + if ($rep->result != IS2LoginReply::LoginResult::OK()) { $self->{'error'} = sprintf("Login reply: login failed, code %d: %s", defined $rep->result_code ? $rep->result_code : 0, defined $rep->result_message ? $rep->result_message : '');