Lines Matching refs:buffer

232 static ssize_t fullread(int filedes, void *buffer, size_t nbytes)  in fullread()  argument
239 (unsigned char *)buffer + nread, nbytes - nread); in fullread()
283 static ssize_t fullwrite(int filedes, const void *buffer, size_t nbytes) in fullwrite() argument
289 ssize_t wc = write(filedes, (const unsigned char *)buffer + nwrite, in fullwrite()
329 static bool read_stdin(void *buffer, size_t nbytes) in read_stdin() argument
331 ssize_t nread = fullread(fileno(stdin), buffer, nbytes); in read_stdin()
346 static bool write_stdout(const void *buffer, size_t nbytes) in write_stdout() argument
348 ssize_t nwrite = fullwrite(fileno(stdout), buffer, nbytes); in write_stdout()
356 static void lograw(unsigned char *buffer, ssize_t len) in lograw() argument
360 unsigned char *ptr = buffer; in lograw()
404 static bool read_data_block(unsigned char *buffer, ssize_t maxlen, in read_data_block() argument
407 if(!read_stdin(buffer, 5)) in read_data_block()
410 buffer[5] = '\0'; in read_data_block()
412 *buffer_len = (ssize_t)strtol((char *)buffer, NULL, 16); in read_data_block()
420 if(!read_stdin(buffer, *buffer_len)) in read_data_block()
423 lograw(buffer, *buffer_len); in read_data_block()
912 unsigned char buffer[BUFFER_SIZE]; in disc_handshake() local
914 if(!read_stdin(buffer, 5)) in disc_handshake()
917 buffer[0], buffer[1], buffer[2], buffer[3]); in disc_handshake()
919 if(!memcmp("ACKD", buffer, 4)) { in disc_handshake()
923 else if(!memcmp("DISC", buffer, 4)) { in disc_handshake()
928 else if(!memcmp("DATA", buffer, 4)) { in disc_handshake()
931 if(!read_data_block(buffer, sizeof(buffer), &buffer_len)) in disc_handshake()
935 else if(!memcmp("QUIT", buffer, 4)) { in disc_handshake()
975 unsigned char buffer[BUFFER_SIZE]; in juggle() local
1092 if(!read_stdin(buffer, 5)) in juggle()
1096 buffer[0], buffer[1], buffer[2], buffer[3]); in juggle()
1098 if(!memcmp("PING", buffer, 4)) { in juggle()
1104 else if(!memcmp("PORT", buffer, 4)) { in juggle()
1107 msnprintf((char *)buffer, sizeof(buffer), "%s/%hu\n", ipv_inuse, port); in juggle()
1108 buffer_len = (ssize_t)strlen((char *)buffer); in juggle()
1112 if(!write_stdout(buffer, buffer_len)) in juggle()
1115 else if(!memcmp("QUIT", buffer, 4)) { in juggle()
1120 else if(!memcmp("DATA", buffer, 4)) { in juggle()
1122 if(!read_data_block(buffer, sizeof(buffer), &buffer_len)) in juggle()
1132 ssize_t bytes_written = swrite(sockfd, buffer, buffer_len); in juggle()
1139 else if(!memcmp("DISC", buffer, 4)) { in juggle()
1181 nread_socket = sread(sockfd, buffer, sizeof(buffer)); in juggle()
1187 if(!write_stdout(buffer, nread_socket)) in juggle()
1191 lograw(buffer, nread_socket); in juggle()