From: Guus Sliepen Date: Fri, 18 May 2007 11:19:31 +0000 (+0000) Subject: More consistent variable naming. X-Git-Tag: release-1.1pre1~171 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=e37ef57a956507cc29e80930201731562b4266e5;p=oweals%2Ftinc.git More consistent variable naming. --- diff --git a/src/bsd/device.c b/src/bsd/device.c index 474612f..70f4757 100644 --- a/src/bsd/device.c +++ b/src/bsd/device.c @@ -142,13 +142,13 @@ void close_device(void) { } bool read_packet(vpn_packet_t *packet) { - int lenin; + int inlen; cp(); switch(device_type) { case DEVICE_TYPE_TUN: - if((lenin = read(device_fd, packet->data + 14, MTU - 14)) <= 0) { + if((inlen = read(device_fd, packet->data + 14, MTU - 14)) <= 0) { logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, device, strerror(errno)); return false; @@ -170,14 +170,14 @@ bool read_packet(vpn_packet_t *packet) { return false; } - packet->len = lenin + 14; + packet->len = inlen + 14; break; case DEVICE_TYPE_TUNIFHEAD: { u_int32_t type; struct iovec vector[2] = {{&type, sizeof(type)}, {packet->data + 14, MTU - 14}}; - if((lenin = readv(device_fd, vector, 2)) <= 0) { + if((inlen = readv(device_fd, vector, 2)) <= 0) { logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, device, strerror(errno)); return false; @@ -201,18 +201,18 @@ bool read_packet(vpn_packet_t *packet) { return false; } - packet->len = lenin + 10; + packet->len = inlen + 10; break; } case DEVICE_TYPE_TAP: - if((lenin = read(device_fd, packet->data, MTU)) <= 0) { + if((inlen = read(device_fd, packet->data, MTU)) <= 0) { logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, device, strerror(errno)); return false; } - packet->len = lenin; + packet->len = inlen; break; default: diff --git a/src/cygwin/device.c b/src/cygwin/device.c index db8cc9e..c4c85d8 100644 --- a/src/cygwin/device.c +++ b/src/cygwin/device.c @@ -176,7 +176,7 @@ bool setup_device(void) { It passes everything it reads to the socket. */ char buf[MTU]; - long lenin; + long inlen; CloseHandle(device_handle); @@ -199,8 +199,8 @@ bool setup_device(void) { /* Pass packets */ for(;;) { - ReadFile(device_handle, buf, MTU, &lenin, NULL); - write(sp[1], buf, lenin); + ReadFile(device_handle, buf, MTU, &inlen, NULL); + write(sp[1], buf, inlen); } } @@ -228,17 +228,17 @@ void close_device(void) { } bool read_packet(vpn_packet_t *packet) { - int lenin; + int inlen; cp(); - if((lenin = read(sp[0], packet->data, MTU)) <= 0) { + if((inlen = read(sp[0], packet->data, MTU)) <= 0) { logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, device, strerror(errno)); return false; } - packet->len = lenin; + packet->len = inlen; device_total_in += packet->len; @@ -249,14 +249,14 @@ bool read_packet(vpn_packet_t *packet) { } bool write_packet(vpn_packet_t *packet) { - long lenout; + long outlen; cp(); ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Writing packet of %d bytes to %s"), packet->len, device_info); - if(!WriteFile (device_handle, packet->data, packet->len, &lenout, NULL)) { + if(!WriteFile (device_handle, packet->data, packet->len, &outlen, NULL)) { logger(LOG_ERR, _("Error while writing to %s %s: %s"), device_info, device, winerror(GetLastError())); return false; } diff --git a/src/linux/device.c b/src/linux/device.c index 519896e..90ba384 100644 --- a/src/linux/device.c +++ b/src/linux/device.c @@ -118,43 +118,43 @@ void close_device(void) { } bool read_packet(vpn_packet_t *packet) { - int lenin; + int inlen; cp(); switch(device_type) { case DEVICE_TYPE_TUN: - lenin = read(device_fd, packet->data + 10, MTU - 10); + inlen = read(device_fd, packet->data + 10, MTU - 10); - if(lenin <= 0) { + if(inlen <= 0) { logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, device, strerror(errno)); return false; } - packet->len = lenin + 10; + packet->len = inlen + 10; break; case DEVICE_TYPE_TAP: - lenin = read(device_fd, packet->data, MTU); + inlen = read(device_fd, packet->data, MTU); - if(lenin <= 0) { + if(inlen <= 0) { logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, device, strerror(errno)); return false; } - packet->len = lenin; + packet->len = inlen; break; case DEVICE_TYPE_ETHERTAP: - lenin = read(device_fd, packet->data - 2, MTU + 2); + inlen = read(device_fd, packet->data - 2, MTU + 2); - if(lenin <= 0) { + if(inlen <= 0) { logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, device, strerror(errno)); return false; } - packet->len = lenin - 2; + packet->len = inlen - 2; break; } diff --git a/src/meta.c b/src/meta.c index af37d01..78b8160 100644 --- a/src/meta.c +++ b/src/meta.c @@ -137,7 +137,7 @@ void broadcast_meta(connection_t *from, const char *buffer, int length) { bool receive_meta(connection_t *c) { int oldlen, i, result; - int lenin, lenout, reqlen; + int inlen, outlen, reqlen; bool decrypted = false; char inbuf[MAXBUFSIZE]; @@ -152,10 +152,10 @@ bool receive_meta(connection_t *c) { - If not, keep stuff in buffer and exit. */ - lenin = recv(c->socket, c->buffer + c->buflen, MAXBUFSIZE - c->buflen, 0); + inlen = recv(c->socket, c->buffer + c->buflen, MAXBUFSIZE - c->buflen, 0); - if(lenin <= 0) { - if(!lenin || !errno) { + if(inlen <= 0) { + if(!inlen || !errno) { ifdebug(CONNECTIONS) logger(LOG_NOTICE, _("Connection closed by %s (%s)"), c->name, c->hostname); } else if(errno == EINTR) @@ -168,19 +168,19 @@ bool receive_meta(connection_t *c) { } oldlen = c->buflen; - c->buflen += lenin; + c->buflen += inlen; - while(lenin > 0) { + while(inlen > 0) { /* Decrypt */ if(c->status.decryptin && !decrypted) { - result = EVP_DecryptUpdate(c->inctx, (unsigned char *)inbuf, &lenout, (unsigned char *)c->buffer + oldlen, lenin); - if(!result || lenout != lenin) { + result = EVP_DecryptUpdate(c->inctx, (unsigned char *)inbuf, &outlen, (unsigned char *)c->buffer + oldlen, inlen); + if(!result || outlen != inlen) { logger(LOG_ERR, _("Error while decrypting metadata from %s (%s): %s"), c->name, c->hostname, ERR_error_string(ERR_get_error(), NULL)); return false; } - memcpy(c->buffer + oldlen, inbuf, lenin); + memcpy(c->buffer + oldlen, inbuf, inlen); decrypted = true; } @@ -191,7 +191,7 @@ bool receive_meta(connection_t *c) { receive_tcppacket(c, c->buffer, c->tcplen); c->buflen -= c->tcplen; - lenin -= c->tcplen - oldlen; + inlen -= c->tcplen - oldlen; memmove(c->buffer, c->buffer + c->tcplen, c->buflen); oldlen = 0; c->tcplen = 0; @@ -219,7 +219,7 @@ bool receive_meta(connection_t *c) { return false; c->buflen -= reqlen; - lenin -= reqlen - oldlen; + inlen -= reqlen - oldlen; memmove(c->buffer, c->buffer + reqlen, c->buflen); oldlen = 0; continue; diff --git a/src/mingw/device.c b/src/mingw/device.c index 0e203e6..b3cbe3b 100644 --- a/src/mingw/device.c +++ b/src/mingw/device.c @@ -336,7 +336,7 @@ bool read_packet(vpn_packet_t *packet) { } bool write_packet(vpn_packet_t *packet) { - long lenout; + long outlen; OVERLAPPED overlapped = {0}; cp(); @@ -344,7 +344,7 @@ bool write_packet(vpn_packet_t *packet) { ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Writing packet of %d bytes to %s"), packet->len, device_info); - if(!WriteFile(device_handle, packet->data, packet->len, &lenout, &overlapped)) { + if(!WriteFile(device_handle, packet->data, packet->len, &outlen, &overlapped)) { logger(LOG_ERR, _("Error while writing to %s %s: %s"), device_info, device, winerror(GetLastError())); return false; } diff --git a/src/raw_socket/device.c b/src/raw_socket/device.c index ac7cc57..c246d1b 100644 --- a/src/raw_socket/device.c +++ b/src/raw_socket/device.c @@ -91,17 +91,17 @@ void close_device(void) { } bool read_packet(vpn_packet_t *packet) { - int lenin; + int inlen; cp(); - if((lenin = read(device_fd, packet->data, MTU)) <= 0) { + if((inlen = read(device_fd, packet->data, MTU)) <= 0) { logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, device, strerror(errno)); return false; } - packet->len = lenin; + packet->len = inlen; device_total_in += packet->len; diff --git a/src/solaris/device.c b/src/solaris/device.c index c66db90..25f66f3 100644 --- a/src/solaris/device.c +++ b/src/solaris/device.c @@ -114,11 +114,11 @@ void close_device(void) { } bool read_packet(vpn_packet_t *packet) { - int lenin; + int inlen; cp(); - if((lenin = read(device_fd, packet->data + 14, MTU - 14)) <= 0) { + if((inlen = read(device_fd, packet->data + 14, MTU - 14)) <= 0) { logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, device, strerror(errno)); return false; @@ -140,7 +140,7 @@ bool read_packet(vpn_packet_t *packet) { return false; } - packet->len = lenin + 14; + packet->len = inlen + 14; device_total_in += packet->len; diff --git a/src/uml_socket/device.c b/src/uml_socket/device.c index 669d78e..27fdd33 100644 --- a/src/uml_socket/device.c +++ b/src/uml_socket/device.c @@ -172,7 +172,7 @@ void close_device(void) { } bool read_packet(vpn_packet_t *packet) { - int lenin; + int inlen; cp(); @@ -202,7 +202,7 @@ bool read_packet(vpn_packet_t *packet) { } case 1: { - if((lenin = read(request_fd, &request, sizeof request)) != sizeof request) { + if((inlen = read(request_fd, &request, sizeof request)) != sizeof request) { logger(LOG_ERR, _("Error while reading request from %s %s: %s"), device_info, device, strerror(errno)); running = false; @@ -232,14 +232,14 @@ bool read_packet(vpn_packet_t *packet) { } case 2: { - if((lenin = read(data_fd, packet->data, MTU)) <= 0) { + if((inlen = read(data_fd, packet->data, MTU)) <= 0) { logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, device, strerror(errno)); running = false; return false; } - packet->len = lenin; + packet->len = inlen; device_total_in += packet->len;