Lines Matching refs:sock
113 void serve_client(int sock, char **device_name, int n_dev);
391 static char do_auth(io_buffer sock, int *version)
407 if (!recv_packet(proto_version, sock, 4)) {
409 send_packet(reply, sock);
420 send_packet(reply, sock);
434 send_packet(reply, sock);
439 if (!recv_packet(mit_cookie, sock, MAX_XAUTHORITY_LENGTH)) {
441 send_packet(reply, sock);
452 send_packet(reply, sock);
494 send_packet(reply, sock);
508 send_packet(reply, sock);
515 send_packet(reply, sock);
651 int sock;
656 if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
667 setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
681 if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0)
690 if (listen(sock, SOMAXCONN) < 0)
696 return (sock);
718 static void server_main_loop(int sock, char **device_name, int n_dev)
734 while ((new_sock = accept(sock, (struct sockaddr *)&addr, &len)) < 0){}
802 int sock;
908 sock = bind_to_port(bind_ip, bind_port);
963 server_main_loop(sock, device_name, n_dev);
998 static void send_reply(int rval, io_buffer sock, int len) {
1008 send_packet(reply, sock);
1025 io_buffer sock;
1040 sock = new_io_buffer(sockhandle);
1048 if (!do_auth(sock, &version)) {
1049 free_io_buffer(sock);
1081 send_reply(0, sock, devFd);
1095 if (!recv_packet(opcode, sock, 1)) {
1099 recv_packet(parm, sock, MAX_DATA_REQUEST);
1109 send_reply(0, sock, -1);
1118 send_reply(0, sock, -1);
1121 send_reply(0, sock, devFd);
1130 send_reply(0, sock, -1);
1135 send_reply(0, sock, -1);
1138 send_reply(0, sock, devFd);
1146 send_reply(devFd, sock, get_length(parm));
1148 send_packet(parm, sock);
1160 send_reply(devFd, sock, rval);
1170 sock,
1178 send_reply(devFd, sock, 0);
1199 send_reply(devFd, sock, -1);
1217 free_io_buffer(sock);
1223 send_reply(rval, sock, 0);