Home
last modified time | relevance | path

Searched refs:sock (Results 1 – 25 of 49) sorted by relevance

12

/system/bt/btif/src/
Dbtif_sock_l2cap.c91 static bt_status_t btSock_start_l2cap_server_l(l2cap_socket *sock);
111 static char packet_get_head_l(l2cap_socket *sock, uint8_t **data, uint32_t *len) in packet_get_head_l() argument
113 struct packet *p = sock->first_packet; in packet_get_head_l()
119 *data = sock->first_packet->data; in packet_get_head_l()
121 *len = sock->first_packet->len; in packet_get_head_l()
122 sock->first_packet = p->next; in packet_get_head_l()
123 if (sock->first_packet) in packet_get_head_l()
124 sock->first_packet->prev = NULL; in packet_get_head_l()
126 sock->last_packet = NULL; in packet_get_head_l()
129 sock->bytes_buffered -= *len; in packet_get_head_l()
[all …]
/system/core/libcutils/
Dsocket_inaddr_any_server_windows.c42 SOCKET sock = socket(AF_INET6, type, 0); in socket_inaddr_any_server() local
43 if (sock == INVALID_SOCKET) { in socket_inaddr_any_server()
53 if (setsockopt(sock, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, (char*)&exclusive, in socket_inaddr_any_server()
55 setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&v6_only, in socket_inaddr_any_server()
57 closesocket(sock); in socket_inaddr_any_server()
67 if (bind(sock, (struct sockaddr*)&addr, sizeof(addr)) == SOCKET_ERROR) { in socket_inaddr_any_server()
68 closesocket(sock); in socket_inaddr_any_server()
73 if (type == SOCK_STREAM && listen(sock, LISTEN_BACKLOG) == SOCKET_ERROR) { in socket_inaddr_any_server()
74 closesocket(sock); in socket_inaddr_any_server()
78 return sock; in socket_inaddr_any_server()
Dsockets_windows.cpp53 int socket_close(cutils_socket_t sock) { in socket_close() argument
54 return closesocket(sock); in socket_close()
57 int socket_set_receive_timeout(cutils_socket_t sock, int timeout_ms) { in socket_set_receive_timeout() argument
58 return setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, in socket_set_receive_timeout()
62 ssize_t socket_send_buffers(cutils_socket_t sock, in socket_send_buffers() argument
80 if (WSASend(sock, wsa_buffers, num_buffers, &bytes_sent, 0, nullptr, in socket_send_buffers()
Dsockets_unix.cpp51 int socket_close(int sock) { in socket_close() argument
52 return close(sock); in socket_close()
55 int socket_set_receive_timeout(cutils_socket_t sock, int timeout_ms) { in socket_set_receive_timeout() argument
59 return setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); in socket_set_receive_timeout()
62 ssize_t socket_send_buffers(cutils_socket_t sock, in socket_send_buffers() argument
78 return writev(sock, iovec_buffers, num_buffers); in socket_send_buffers()
Dsocket_network_client_windows.c54 SOCKET sock = socket(address->ai_family, address->ai_socktype, in socket_network_client() local
56 if (sock == INVALID_SOCKET) { in socket_network_client()
61 if (connect(sock, address->ai_addr, address->ai_addrlen) == SOCKET_ERROR) { in socket_network_client()
62 closesocket(sock); in socket_network_client()
68 return sock; in socket_network_client()
Dsockets.cpp38 int socket_get_local_port(cutils_socket_t sock) { in socket_get_local_port() argument
42 if (getsockname(sock, reinterpret_cast<sockaddr*>(&addr), &addr_size) == 0) { in socket_get_local_port()
/system/netd/server/
Dndc.c35 static int do_monitor(int sock, int stop_after_cmd);
36 static int do_cmd(int sock, int argc, char **argv);
39 int sock; in main() local
47 if ((sock = socket_local_client(argv[1], in main()
50 if ((sock = socket_local_client("netd", in main()
63 exit(do_monitor(sock, 0)); in main()
64 exit(do_cmd(sock, argc-cmdOffset, &(argv[cmdOffset]))); in main()
67 static int do_cmd(int sock, int argc, char **argv) { in do_cmd() argument
106 if (write(sock, final_cmd, strlen(final_cmd) + 1) < 0) { in do_cmd()
114 return do_monitor(sock, 1); in do_cmd()
[all …]
DNetlinkManager.cpp67 NetlinkHandler *NetlinkManager::setupSocket(int *sock, int netlinkFamily, in setupSocket() argument
79 if ((*sock = socket(PF_NETLINK, SOCK_DGRAM | SOCK_CLOEXEC, netlinkFamily)) < 0) { in setupSocket()
84 if (setsockopt(*sock, SOL_SOCKET, SO_RCVBUFFORCE, &sz, sizeof(sz)) < 0) { in setupSocket()
86 close(*sock); in setupSocket()
90 if (setsockopt(*sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)) < 0) { in setupSocket()
92 close(*sock); in setupSocket()
96 if (bind(*sock, (struct sockaddr *) &nladdr, sizeof(nladdr)) < 0) { in setupSocket()
98 close(*sock); in setupSocket()
103 if (android_nflog_send_config_cmd(*sock, 0, NFULNL_CFG_CMD_PF_UNBIND, AF_INET) < 0) { in setupSocket()
107 if (android_nflog_send_config_cmd(*sock, 0, NFULNL_CFG_CMD_PF_BIND, AF_INET) < 0) { in setupSocket()
[all …]
/system/vold/
Dvdc.cpp39 static int do_monitor(int sock, int stop_after_cmd);
40 static int do_cmd(int sock, int argc, char **argv);
45 int sock; in main() local
67 while ((sock = socket_local_client(sockname, in main()
79 exit(do_monitor(sock, 0)); in main()
81 exit(do_cmd(sock, argc, argv)); in main()
85 static int do_cmd(int sock, int argc, char **argv) { in do_cmd() argument
103 if (TEMP_FAILURE_RETRY(write(sock, cmd.c_str(), cmd.length() + 1)) < 0) { in do_cmd()
108 return do_monitor(sock, seq); in do_cmd()
111 static int do_monitor(int sock, int stop_after_seq) { in do_monitor() argument
[all …]
/system/core/fastboot/
Dsocket.cpp34 Socket::Socket(cutils_socket_t sock) : sock_(sock) {} in Socket() argument
112 UdpSocket(Type type, cutils_socket_t sock);
125 UdpSocket::UdpSocket(Type type, cutils_socket_t sock) : Socket(sock) { in UdpSocket() argument
170 TcpSocket(cutils_socket_t sock) : Socket(sock) {} in TcpSocket() argument
249 cutils_socket_t sock = socket_network_client(host.c_str(), port, SOCK_DGRAM); in NewClient() local
250 if (sock != INVALID_SOCKET) { in NewClient()
251 return std::unique_ptr<UdpSocket>(new UdpSocket(UdpSocket::Type::kClient, sock)); in NewClient()
254 cutils_socket_t sock = socket_network_client(host.c_str(), port, SOCK_STREAM); in NewClient() local
255 if (sock != INVALID_SOCKET) { in NewClient()
256 return std::unique_ptr<TcpSocket>(new TcpSocket(sock)); in NewClient()
[all …]
Dsocket_test.cpp64 static bool SendString(Socket* sock, const std::string& message) { in SendString() argument
65 return sock->Send(message.c_str(), message.length()); in SendString()
70 static bool ReceiveString(Socket* sock, const std::string& message) { in ReceiveString() argument
72 ssize_t bytes = sock->ReceiveAll(&received[0], received.length(), kTestTimeoutMs); in ReceiveString()
175 std::unique_ptr<Socket> sock = Socket::NewServer(Socket::Protocol::kUdp, 0); in TEST() local
184 sock->socket_send_buffers_function_ = [&buffers, &mock_return_value]( in TEST()
196 EXPECT_TRUE(sock->Send(buffers)); in TEST()
199 EXPECT_FALSE(sock->Send(buffers)); in TEST()
202 EXPECT_FALSE(sock->Send(buffers)); in TEST()
205 EXPECT_FALSE(sock->Send(buffers)); in TEST()
[all …]
Dsocket_mock.cpp120 std::unique_ptr<Socket> sock = std::move(events_.front().sock); in Accept() local
122 return sock; in Accept()
145 void SocketMock::AddAccept(std::unique_ptr<Socket> sock) { in AddAccept() argument
146 events_.push(Event(EventType::kAccept, "", false, std::move(sock))); in AddAccept()
151 : type(_type), message(_message), status(_status), sock(std::move(_sock)) {} in Event()
Dtcp.cpp69 TcpTransport(std::unique_ptr<Socket> sock) : socket_(std::move(sock)) {} in TcpTransport() argument
188 std::unique_ptr<Transport> Connect(std::unique_ptr<Socket> sock, std::string* error) { in Connect() argument
189 if (sock == nullptr) { in Connect()
194 return TcpTransport::NewTransport(std::move(sock), error); in Connect()
/system/core/liblog/
Dlogd_writer.c56 .context.sock = -1,
69 if (logdLoggerWrite.context.sock < 0) { in logdOpen()
87 logdLoggerWrite.context.sock = i; in logdOpen()
97 if (logdLoggerWrite.context.sock >= 0) { in logdClose()
98 close(logdLoggerWrite.context.sock); in logdClose()
99 logdLoggerWrite.context.sock = -1; in logdClose()
108 if (logdLoggerWrite.context.sock < 0) { in logdAvailable()
128 if (logdLoggerWrite.context.sock < 0) { in logdWrite()
167 if (logdLoggerWrite.context.sock > 0) { in logdWrite()
181 ret = TEMP_FAILURE_RETRY(writev(logdLoggerWrite.context.sock, newVec, 2)); in logdWrite()
[all …]
Dlogd_reader.c270 int sock = socket_local_client("logd", ANDROID_SOCKET_NAMESPACE_RESERVED, in send_log_msg() local
272 if (sock < 0) { in send_log_msg()
273 return sock; in send_log_msg()
281 ret = TEMP_FAILURE_RETRY(write(sock, buf, len)); in send_log_msg()
288 while ((ret = TEMP_FAILURE_RETRY(read(sock, cp, len))) > 0) { in send_log_msg()
299 p.fd = sock; in send_log_msg()
323 close(sock); in send_log_msg()
488 int sock = transp->context.sock; in logdOpen() local
489 if (sock > 0) { in logdOpen()
490 return sock; in logdOpen()
[all …]
/system/extras/tests/net_test/
Dsock_diag_test.py55 def assertSocketClosed(self, sock): argument
56 self.assertRaisesErrno(ENOTCONN, sock.getpeername)
58 def assertSocketConnected(self, sock): argument
59 sock.getpeername() # No errors? Socket is alive and connected.
62 for sock in socketpair:
63 self.assertSocketClosed(sock)
103 for sock in socketpair:
104 diag_msg = self.sock_diag.FindSockDiagFromFd(sock)
139 for sock in socketpair:
142 sock,
[all …]
Dtcp_nuke_addr_test.py126 def __init__(self, sock): argument
127 self.sock = sock
134 read = self.sock.recv(4096)
182 self.assertRaisesErrno(errno.ENOTCONN, thread.sock.getpeername)
183 self.assertRaisesErrno(errno.EISCONN, thread.sock.connect,
185 self.assertRaisesErrno(errno.EPIPE, thread.sock.send, "foo")
192 for sock in socketpair:
193 self.assertRaisesErrno(errno.ENOTCONN, sock.getpeername)
196 for sock in socketpair:
197 self.assertTrue(sock.getpeername())
[all …]
Dnetlink.py138 self.sock = socket.socket(socket.AF_NETLINK, socket.SOCK_RAW, self.FAMILY)
139 self.sock.connect((0, 0)) # The kernel.
140 self.pid = self.sock.getsockname()[1]
145 self.sock.send(msg)
148 data = self.sock.recv(self.BUFSIZE)
/system/core/libcutils/tests/
Dsockets_test.cpp76 void TestReceiveTimeout(cutils_socket_t sock) { in TestReceiveTimeout() argument
81 EXPECT_EQ(0, socket_set_receive_timeout(sock, 20)); in TestReceiveTimeout()
83 EXPECT_EQ(-1, recv(sock, buffer, sizeof(buffer), 0)); in TestReceiveTimeout()
87 EXPECT_EQ(0, socket_set_receive_timeout(sock, 1250)); in TestReceiveTimeout()
89 EXPECT_EQ(-1, recv(sock, buffer, sizeof(buffer), 0)); in TestReceiveTimeout()
160 cutils_socket_t sock = socket_inaddr_any_server(0, SOCK_DGRAM); in TEST() local
161 ASSERT_NE(INVALID_SOCKET, sock); in TEST()
163 TestReceiveTimeout(sock); in TEST()
165 EXPECT_EQ(0, socket_close(sock)); in TEST()
/system/bt/tools/hci/
Dmain.c171 int sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); in write_hci_command() local
172 if (sock == INVALID_FD) in write_hci_command()
180 OSI_NO_INTR(ret = connect(sock, (const struct sockaddr *)&addr, in write_hci_command()
185 if (send(sock, &type, 1, 0) != 1) in write_hci_command()
188 if (send(sock, &length, 2, 0) != 2) in write_hci_command()
191 if (send(sock, packet, length, 0) != (ssize_t)length) in write_hci_command()
194 close(sock); in write_hci_command()
198 close(sock); in write_hci_command()
/system/core/logd/
DLogListener.cpp123 int sock = android_get_control_socket(socketName); in getLogSocket() local
125 if (sock < 0) { in getLogSocket()
126 sock = socket_local_server(socketName, in getLogSocket()
132 if (setsockopt(sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)) < 0) { in getLogSocket()
135 return sock; in getLogSocket()
/system/core/include/cutils/
Dsockets.h124 int socket_close(cutils_socket_t sock);
132 int socket_set_receive_timeout(cutils_socket_t sock, int timeout_ms);
137 int socket_get_local_port(cutils_socket_t sock);
160 ssize_t socket_send_buffers(cutils_socket_t sock,
/system/core/libmemunreachable/
DLeakPipe.cpp24 bool LeakPipe::SendFd(int sock, int fd) { in SendFd() argument
45 int ret = sendmsg(sock, &hdr, 0); in SendFd()
58 int LeakPipe::ReceiveFd(int sock) { in ReceiveFd() argument
72 int ret = recvmsg(sock, &hdr, 0); in ReceiveFd()
/system/core/logd/tests/
Dlogd_test.cpp41 int sock = socket_local_client("logd", in my_android_logger_get_statistics() local
44 if (sock >= 0) { in my_android_logger_get_statistics()
45 if (write(sock, buf, strlen(buf) + 1) > 0) { in my_android_logger_get_statistics()
47 while ((ret = read(sock, buf, len)) > 0) { in my_android_logger_get_statistics()
55 .fd = sock, in my_android_logger_get_statistics()
66 close(sock); in my_android_logger_get_statistics()
489 int sock = socket_local_client("logd", in TEST() local
493 ASSERT_TRUE(sock >= 0); in TEST()
496 if (write(sock, getPruneList, sizeof(getPruneList)) > 0) { in TEST()
499 read(sock, buffer, sizeof(buffer)); in TEST()
[all …]
/system/bt/tools/bdtool/
Dbdtool.c201 const btsock_interface_t *sock = bt_interface->get_profile_interface(BT_PROFILE_SOCKETS_ID); in main() local
204 …int error = sock->listen(BTSOCK_RFCOMM, "meow", (const uint8_t *)&HFP_AG_UUID, 0, &rfcomm_fd, 0, a… in main()
211 error = sock->listen(BTSOCK_SCO, NULL, NULL, 5, &sock_fd, 0, app_uid); in main()
229 const btsock_interface_t *sock = bt_interface->get_profile_interface(BT_PROFILE_SOCKETS_ID); in main() local
232 …int error = sock->connect(&bt_remote_bdaddr, BTSOCK_RFCOMM, (const uint8_t *)&HFP_AG_UUID, 0, &rfc… in main()
243 error = sock->connect(&bt_remote_bdaddr, BTSOCK_SCO, NULL, 5, &sock_fd, 0, app_uid); in main()

12