Lines Matching refs:buffer
189 char buffer[512]; in getconfig() local
191 while(fgets(buffer, sizeof(buffer), fp)) { in getconfig()
194 if(2 == sscanf(buffer, "%31s %259s", key, value)) { in getconfig()
242 static void loghex(unsigned char *buffer, ssize_t len) in loghex() argument
246 unsigned char *ptr = buffer; in loghex()
310 unsigned char *buffer, in socks4() argument
318 if(buffer[SOCKS4_CD] != 1) { in socks4()
319 logmsg("SOCKS4 CD is not 1: %d", buffer[SOCKS4_CD]); in socks4()
327 s4port = (unsigned short)((buffer[SOCKS4_DSTPORT] << 8) | in socks4()
328 (buffer[SOCKS4_DSTPORT + 1])); in socks4()
344 memcpy(&response[2], &buffer[SOCKS4_DSTPORT], 6); in socks4()
365 unsigned char buffer[2*256 + 16]; in sockit() local
378 rc = recv(fd, (char *)buffer, sizeof(buffer), 0); in sockit()
385 loghex(buffer, rc); in sockit()
387 if(buffer[SOCKS5_VERSION] == 4) in sockit()
388 return socks4(fd, buffer, rc); in sockit()
395 if(buffer[SOCKS5_VERSION] != config.version) { in sockit()
399 if((buffer[SOCKS5_NMETHODS] < config.nmethods_min) || in sockit()
400 (buffer[SOCKS5_NMETHODS] > config.nmethods_max)) { in sockit()
407 if(rc != (buffer[SOCKS5_NMETHODS] + 2)) { in sockit()
408 logmsg("Expected %d bytes, got %zd", buffer[SOCKS5_NMETHODS] + 2, rc); in sockit()
425 rc = recv(fd, (char *)buffer, sizeof(buffer), 0); in sockit()
432 loghex(buffer, rc); in sockit()
449 if(buffer[SOCKS5_VERSION] != 1) { in sockit()
450 logmsg("Auth VERSION byte not 1, got %d", buffer[SOCKS5_VERSION]); in sockit()
453 ulen = buffer[SOCKS5_ULEN]; in sockit()
458 plen = buffer[SOCKS5_ULEN + ulen + 1]; in sockit()
465 memcmp(&buffer[SOCKS5_UNAME], config.user, ulen) || in sockit()
466 memcmp(&buffer[SOCKS5_UNAME + ulen + 1], config.password, plen)) { in sockit()
484 rc = recv(fd, (char *)buffer, sizeof(buffer), 0); in sockit()
491 loghex(buffer, rc); in sockit()
498 if(buffer[SOCKS5_VERSION] != config.version) { in sockit()
503 if(buffer[SOCKS5_REQCMD] != config.reqcmd) { in sockit()
508 if(buffer[SOCKS5_RESERVED]) { in sockit()
517 type = buffer[SOCKS5_ATYP]; in sockit()
518 address = &buffer[SOCKS5_DSTADDR]; in sockit()
527 len = buffer[SOCKS5_DSTADDR]; in sockit()
574 unsigned char *portp = &buffer[SOCKS5_DSTADDR + len]; in sockit()
618 &buffer[SOCKS5_DSTADDR + len], sizeof(socksport)); in sockit()
650 char buffer[512]; in tunnel() local
653 nread = recv(cp->clientfd, buffer, sizeof(buffer), 0); in tunnel()
655 nwrite = send(cp->remotefd, (char *)buffer, in tunnel()
666 nread = recv(cp->remotefd, buffer, sizeof(buffer), 0); in tunnel()
668 nwrite = send(cp->clientfd, (char *)buffer, in tunnel()