Renamed c->handler to handler_line_in

This commit is contained in:
Heikki Hannikainen 2013-04-13 14:06:09 +03:00
parent e8e2d2b096
commit 8da002be7f
6 changed files with 12 additions and 11 deletions

View File

@ -580,7 +580,7 @@ static void peerip_clients_config(void)
c->state = CSTATE_COREPEER;
c->validated = VALIDATED_WEAK;
c->flags = CLFLAGS_UPLINKPORT;
c->handler = &incoming_handler;
c->handler_line_in = &incoming_handler;
memcpy((void *)&c->udpaddr.sa, (void *)pe->ai->ai_addr, pe->ai->ai_addrlen);
c->udpaddrlen = pe->ai->ai_addrlen;
c->udp_port = pe->remote_port; // remote port
@ -1131,7 +1131,7 @@ static void do_accept(struct listen_t *l)
c->state = CSTATE_LOGIN;
/* use the default login handler */
c->handler = &login_handler;
c->handler_line_in = &login_handler;
c->keepalive = tick; /* monotonous time, for timed transmits */
#ifdef USE_SSL
@ -1333,13 +1333,13 @@ static int accept_liveupgrade_single(cJSON *client, int *rxerr_map, int rxerr_ma
if (strcmp(state->valuestring, "connected") == 0) {
c->state = CSTATE_CONNECTED;
c->handler = &incoming_handler;
c->handler_line_in = &incoming_handler;
strncpy(c->username, username->valuestring, sizeof(c->username));
c->username[sizeof(c->username)-1] = 0;
c->username_len = strlen(c->username);
} else if (strcmp(state->valuestring, "login") == 0) {
c->state = CSTATE_LOGIN;
c->handler = &login_handler;
c->handler_line_in = &login_handler;
} else {
hlog(LOG_ERR, "Live upgrade: Client %s is in invalid state '%s' (fd %d)", l->addr_s, state->valuestring, l->fd);
goto err;

View File

@ -392,7 +392,7 @@ int login_handler(struct worker_t *self, struct client_t *c, int l4proto, char *
sanitize_ascii_string(c->filter_s);
/* ok, login succeeded, switch handler */
c->handler = &incoming_handler; /* handler of all incoming APRS-IS data during a connection */
c->handler_line_in = &incoming_handler; /* handler of all incoming APRS-IS data during a connection */
rc = client_printf( self, c, "# logresp %s %s, server %s\r\n",
username,

View File

@ -227,7 +227,7 @@ int uplink_logresp_handler(struct worker_t *self, struct client_t *c, int l4prot
hlog(LOG_INFO, "%s: Uplink logged in to server %s", c->addr_rem, c->username);
c->handler = incoming_handler;
c->handler_line_in = incoming_handler;
/* mark as connected and classify */
worker_mark_client_connected(self, c);
@ -287,7 +287,7 @@ int uplink_login_handler(struct worker_t *self, struct client_t *c, int l4proto,
rc = client_write(self, c, buf, len);
if (rc < -2) return rc; // the client was destroyed by client_write, don't touch it
c->handler = uplink_logresp_handler;
c->handler_line_in = uplink_logresp_handler;
c->state = CSTATE_LOGRESP;
hlog(LOG_INFO, "%s: Connected to server, logging in", c->addr_rem);
@ -565,7 +565,7 @@ connerr:
c->ai_protocol = req.ai_protocol;
c->state = CSTATE_INIT;
/* use the default login handler */
c->handler = & uplink_login_handler;
c->handler_line_in = &uplink_login_handler;
c->flags = l->client_flags;
c->keepalive = tick;
c->last_read = tick;

View File

@ -1094,7 +1094,7 @@ static int handle_corepeer_readable(struct worker_t *self, struct client_t *c)
}
}
c->handler(self, rc, IPPROTO_UDP, c->ibuf, r);
c->handler_line_in(self, rc, IPPROTO_UDP, c->ibuf, r);
return 0;
}
@ -1136,7 +1136,7 @@ int client_postread(struct worker_t *self, struct client_t *c, int r)
// *s = ch;
/* NOTE: handler call CAN destroy the c-> object ! */
if (c->handler(self, c, IPPROTO_TCP, row_start, s - row_start) < 0)
if (c->handler_line_in(self, c, IPPROTO_TCP, row_start, s - row_start) < 0)
return -1;
}
/* skip the first, just-found part of EOL, which might have been

View File

@ -354,7 +354,7 @@ struct client_t {
char quirks_mode; /* is this a known buggy-and-unmaintained application on our blacklist */
/* the current handler function for incoming lines */
int (*handler) (struct worker_t *self, struct client_t *c, int l4proto, char *s, int len);
int (*handler_line_in) (struct worker_t *self, struct client_t *c, int l4proto, char *s, int len);
/* outbound filter chain head */
struct filter_t *posdefaultfilters;

View File

@ -79,6 +79,7 @@ my @pkts = (
"SRC2>DST,DIGI,TCPXX*,qAR,$login:>Packet from unverified login according to TCPXX* in path",
"SRC->DST,DIGI-0,qAR,$login:>should drop, too short SSID in srccall",
"SRC-111>DST,DIGI-0,qAR,$login:>should drop, too long SSID in srccall",
"EL-DH5FFL>DST,DIGI-0,qAR,$login:>should drop, much too long SSID in srccall",
"SRC>DST,DIGI-0,qAR,$login:>should drop, -0 SSID in viacall",
);