Home
last modified time | relevance | path

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

123

/packages/modules/Bluetooth/system/btif/src/
Dbtif_sock_l2cap.cc85 static void btsock_l2cap_server_listen(l2cap_socket* sock);
112 static char packet_get_head_l(l2cap_socket* sock, uint8_t** data, in packet_get_head_l() argument
114 struct packet* p = sock->first_packet; in packet_get_head_l()
118 if (data) *data = sock->first_packet->data; in packet_get_head_l()
119 if (len) *len = sock->first_packet->len; in packet_get_head_l()
120 sock->first_packet = p->next; in packet_get_head_l()
121 if (sock->first_packet) in packet_get_head_l()
122 sock->first_packet->prev = NULL; in packet_get_head_l()
124 sock->last_packet = NULL; in packet_get_head_l()
126 if (len) sock->bytes_buffered -= *len; in packet_get_head_l()
[all …]
/packages/modules/StatsD/lib/libstatssocket/
Dstatsd_writer.cpp84 .sock = -EBADF,
97 i = atomic_load(&statsdLoggerWrite.sock); in statsdOpen()
106 int sock = TEMP_FAILURE_RETRY(socket(PF_UNIX, flags, 0)); in statsdOpen() local
107 if (sock < 0) { in statsdOpen()
114 setsockopt(sock, SOL_SOCKET, SO_SNDBUF, &sndbuf, bufLen); in statsdOpen()
121 connect(sock, (struct sockaddr*)&un, sizeof(struct sockaddr_un))) < 0) { in statsdOpen()
127 i = atomic_exchange(&statsdLoggerWrite.sock, ret); in statsdOpen()
132 close(sock); in statsdOpen()
134 ret = atomic_exchange(&statsdLoggerWrite.sock, sock); in statsdOpen()
135 if ((ret >= 0) && (ret != sock)) { in statsdOpen()
[all …]
/packages/modules/Connectivity/thread/service/jni/
Dcom_android_server_thread_InfraInterfaceController.cpp55 int sock = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6); in com_android_server_thread_InfraInterfaceController_createIcmp6Socket() local
56 if (sock == -1) { in com_android_server_thread_InfraInterfaceController_createIcmp6Socket()
69 if (setsockopt(sock, IPPROTO_ICMPV6, ICMP6_FILTER, &filter, sizeof(filter)) != 0) { in com_android_server_thread_InfraInterfaceController_createIcmp6Socket()
72 close(sock); in com_android_server_thread_InfraInterfaceController_createIcmp6Socket()
78 if (setsockopt(sock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &kEnable, sizeof(kEnable)) != 0) { in com_android_server_thread_InfraInterfaceController_createIcmp6Socket()
81 close(sock); in com_android_server_thread_InfraInterfaceController_createIcmp6Socket()
85 if (setsockopt(sock, IPPROTO_RAW, IPV6_CHECKSUM, &kIpv6ChecksumOffset, in com_android_server_thread_InfraInterfaceController_createIcmp6Socket()
89 close(sock); in com_android_server_thread_InfraInterfaceController_createIcmp6Socket()
94 if (setsockopt(sock, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &kEnable, sizeof(kEnable)) != 0) { in com_android_server_thread_InfraInterfaceController_createIcmp6Socket()
97 close(sock); in com_android_server_thread_InfraInterfaceController_createIcmp6Socket()
[all …]
/packages/modules/Connectivity/staticlibs/netd/libnetdutils/include/netdutils/
DSyscalls.h50 virtual Status getsockname(Fd sock, sockaddr* addr, socklen_t* addrlen) const = 0;
52 virtual Status getsockopt(Fd sock, int level, int optname, void *optval,
55 virtual Status setsockopt(Fd sock, int level, int optname, const void* optval,
58 virtual Status bind(Fd sock, const sockaddr* addr, socklen_t addrlen) const = 0;
60 virtual Status connect(Fd sock, const sockaddr* addr, socklen_t addrlen) const = 0;
62 virtual StatusOr<ifreq> ioctl(Fd sock, unsigned long request, ifreq* ifr) const = 0;
74 virtual StatusOr<size_t> sendto(Fd sock, const Slice buf, int flags, const sockaddr* dst,
77 virtual StatusOr<Slice> recvfrom(Fd sock, const Slice dst, int flags, sockaddr* src,
117 StatusOr<SockaddrT> getsockname(Fd sock) const { in getsockname() argument
120 RETURN_IF_NOT_OK(getsockname(sock, asSockaddrPtr(&addr), &addrlen)); in getsockname()
[all …]
DMockSyscalls.h39 MOCK_CONST_METHOD3(getsockname, Status(Fd sock, sockaddr* addr, socklen_t* addrlen));
40 MOCK_CONST_METHOD5(getsockopt, Status(Fd sock, int level, int optname, void* optval,
42 MOCK_CONST_METHOD5(setsockopt, Status(Fd sock, int level, int optname, const void* optval,
45 MOCK_CONST_METHOD3(bind, Status(Fd sock, const sockaddr* addr, socklen_t addrlen));
46 MOCK_CONST_METHOD3(connect, Status(Fd sock, const sockaddr* addr, socklen_t addrlen));
47 MOCK_CONST_METHOD3(ioctl, StatusOr<ifreq>(Fd sock, unsigned long request, ifreq* ifr));
56 MOCK_CONST_METHOD5(sendto, StatusOr<size_t>(Fd sock, const Slice buf, int flags,
58 MOCK_CONST_METHOD5(recvfrom, StatusOr<Slice>(Fd sock, const Slice dst, int flags, sockaddr* src,
/packages/modules/Connectivity/staticlibs/netd/libnetdutils/
DSyscalls.cpp53 UniqueFd sock(::socket(domain, type, protocol)); in socket() local
54 if (!isWellFormed(sock)) { in socket()
57 return sock; in socket()
60 Status getsockname(Fd sock, sockaddr* addr, socklen_t* addrlen) const override { in getsockname() argument
61 auto rv = ::getsockname(sock.get(), addr, addrlen); in getsockname()
68 Status getsockopt(Fd sock, int level, int optname, void* optval, in getsockopt() argument
70 auto rv = ::getsockopt(sock.get(), level, optname, optval, optlen); in getsockopt()
77 Status setsockopt(Fd sock, int level, int optname, const void* optval, in setsockopt() argument
79 auto rv = ::setsockopt(sock.get(), level, optname, optval, optlen); in setsockopt()
86 Status bind(Fd sock, const sockaddr* addr, socklen_t addrlen) const override { in bind() argument
[all …]
DSocketOption.cpp29 Status enableSockopt(Fd sock, int level, int optname) { in enableSockopt() argument
32 return sys.setsockopt(sock, level, optname, &on, sizeof(on)); in enableSockopt()
35 Status enableTcpKeepAlives(Fd sock, unsigned idleTime, unsigned numProbes, unsigned probeInterval) { in enableTcpKeepAlives() argument
36 RETURN_IF_NOT_OK(enableSockopt(sock, SOL_SOCKET, SO_KEEPALIVE)); in enableTcpKeepAlives()
40 RETURN_IF_NOT_OK(sys.setsockopt(sock, SOL_TCP, TCP_KEEPIDLE, &idleTime, sizeof(idleTime))); in enableTcpKeepAlives()
43 RETURN_IF_NOT_OK(sys.setsockopt(sock, SOL_TCP, TCP_KEEPCNT, &numProbes, sizeof(numProbes))); in enableTcpKeepAlives()
46 RETURN_IF_NOT_OK(sys.setsockopt(sock, SOL_TCP, TCP_KEEPINTVL, &probeInterval, in enableTcpKeepAlives()
/packages/modules/Connectivity/netd/
DBpfBaseTest.cpp67 int sock = socket(AF_INET6, SOCK_STREAM | SOCK_CLOEXEC, 0); in TEST_F() local
68 ASSERT_LE(0, sock); in TEST_F()
69 uint64_t cookie = getSocketCookie(sock); in TEST_F()
71 ASSERT_EQ(0, qtaguid_tagSocket(sock, TEST_TAG, TEST_UID)); in TEST_F()
76 ASSERT_EQ(0, qtaguid_untagSocket(sock)); in TEST_F()
85 int sock = socket(AF_INET6, SOCK_STREAM | SOCK_CLOEXEC, 0); in TEST_F() local
86 ASSERT_LE(0, sock); in TEST_F()
87 uint64_t cookie = getSocketCookie(sock); in TEST_F()
89 ASSERT_EQ(0, qtaguid_tagSocket(sock, TEST_TAG, TEST_UID)); in TEST_F()
94 ASSERT_EQ(0, close(sock)); in TEST_F()
DBpfHandlerTest.cpp85 int sock = socket(protocol, SOCK_STREAM | SOCK_CLOEXEC, 0); in setUpSocketAndTag() local
86 EXPECT_LE(0, sock); in setUpSocketAndTag()
87 *cookie = getSocketCookie(sock); in setUpSocketAndTag()
89 EXPECT_EQ(0, mBh.tagSocket(sock, tag, uid, realUid)); in setUpSocketAndTag()
90 return sock; in setUpSocketAndTag()
122 int sock = socket(AF_INET6, SOCK_STREAM | SOCK_CLOEXEC, 0); in expectTagSocketReachLimit() local
123 EXPECT_LE(0, sock); in expectTagSocketReachLimit()
124 if (sock < 0) return; in expectTagSocketReachLimit()
125 uint64_t sockCookie = getSocketCookie(sock); in expectTagSocketReachLimit()
127 EXPECT_EQ(-EMFILE, mBh.tagSocket(sock, tag, uid, uid)); in expectTagSocketReachLimit()
[all …]
/packages/modules/DnsResolver/tests/
Ddoh_ffi_test.cpp51 unique_fd sock(socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, IPPROTO_UDP)); in haveIpv4() local
52 if (sock == -1) { in haveIpv4()
56 return connect(sock, reinterpret_cast<const sockaddr*>(&server), sizeof(server)) == 0; in haveIpv4()
64 unique_fd sock(socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, IPPROTO_UDP)); in haveIpv6() local
65 if (sock == -1) { in haveIpv6()
69 return connect(sock, reinterpret_cast<const sockaddr*>(&server), sizeof(server)) == 0; in haveIpv6()
97 auto tag_socket_cb = [](int32_t sock) { EXPECT_GE(sock, 0); }; in TEST_F() argument
/packages/modules/Bluetooth/system/gd/rust/linux/stack/src/
Dsocket_manager.rs142 let mut sock = BluetoothSocket::new(); in to_connecting_socket() localVariable
145 sock.id = self.id; in to_connecting_socket()
146 sock.sock_type = self.sock_type.clone(); in to_connecting_socket()
147 sock.flags = self.flags; in to_connecting_socket()
148 sock.uuid = self.uuid.clone(); in to_connecting_socket()
151 sock.remote_device = BluetoothDevice::new(conn.addr, "".into()); in to_connecting_socket()
152 sock.port = conn.channel; in to_connecting_socket()
153 sock.max_rx_size = conn.max_rx_packet_size.into(); in to_connecting_socket()
154 sock.max_tx_size = conn.max_tx_packet_size.into(); in to_connecting_socket()
155 sock.fd = match socket::try_from_fd(sockfd.unwrap_or(-1)) { in to_connecting_socket()
[all …]
/packages/modules/Connectivity/service/jni/
Dcom_android_server_connectivity_ClatCoordinator.cpp270 const int sock = socket(AF_PACKET, SOCK_RAW | SOCK_CLOEXEC, 0); in com_android_server_connectivity_ClatCoordinator_openPacketSocket() local
271 if (sock < 0) { in com_android_server_connectivity_ClatCoordinator_openPacketSocket()
277 if (setsockopt(sock, SOL_PACKET, PACKET_AUXDATA, &on, sizeof(on))) { in com_android_server_connectivity_ClatCoordinator_openPacketSocket()
279 close(sock); in com_android_server_connectivity_ClatCoordinator_openPacketSocket()
283 if (setsockopt(sock, SOL_PACKET, PACKET_VNET_HDR, &on, sizeof(on))) { in com_android_server_connectivity_ClatCoordinator_openPacketSocket()
285 close(sock); in com_android_server_connectivity_ClatCoordinator_openPacketSocket()
288 return sock; in com_android_server_connectivity_ClatCoordinator_openPacketSocket()
294 int sock = socket(AF_INET6, SOCK_RAW | SOCK_NONBLOCK | SOCK_CLOEXEC, IPPROTO_RAW); in com_android_server_connectivity_ClatCoordinator_openRawSocket6() local
295 if (sock < 0) { in com_android_server_connectivity_ClatCoordinator_openRawSocket6()
301 if (setsockopt(sock, SOL_SOCKET, SO_MARK, &mark, sizeof(mark)) < 0) { in com_android_server_connectivity_ClatCoordinator_openRawSocket6()
[all …]
/packages/modules/Connectivity/tests/native/connectivity_native_test/
Dconnectivity_native_test.cpp94 int sock, sock2; in runSocketTest() local
96 sock = openSocket(&port, family, type, false /* expectBindFail */); in runSocketTest()
116 close(sock); in runSocketTest()
127 const int sock = socket(family, type, 0); in openSocket() local
128 ret = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable)); in openSocket()
133 ret = bind(sock, (struct sockaddr*) &addr4, sizeof(addr4)); in openSocket()
136 ret = bind(sock, (struct sockaddr*) &addr6, sizeof(addr6)); in openSocket()
143 close(sock); in openSocket()
151 EXPECT_NE(-1, getsockname(sock, (struct sockaddr *)&sin, &len)); in openSocket()
158 EXPECT_NE(-1, getsockname(sock, (struct sockaddr *)&sin, &len)); in openSocket()
[all …]
/packages/modules/IPsec/src/java/com/android/internal/net/ipsec/ike/net/
DIkeLocalAddressGenerator.java38 FileDescriptor sock = in generateLocalAddress() local
43 network.bindSocket(sock); in generateLocalAddress()
44 Os.connect(sock, remoteAddress, serverPort); in generateLocalAddress()
45 InetSocketAddress localAddr = (InetSocketAddress) Os.getsockname(sock); in generateLocalAddress()
46 Os.close(sock); in generateLocalAddress()
/packages/modules/IPsec/src/java/com/android/internal/net/ipsec/ike/
DIkeUdp4Socket.java70 FileDescriptor sock = Os.socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); in getInstance() local
71 TrafficStats.tagFileDescriptor(sock); in getInstance()
72 Os.bind(sock, INADDR_ANY, 0); in getInstance()
73 applySocketConfig(sockConfig, sock, false /* isIpv6 */); in getInstance()
75 ikeSocket = new IkeUdp4Socket(sock, sockConfig, handler); in getInstance()
DIkeUdp6Socket.java83 FileDescriptor sock = Os.socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); in openUdp6Sock() local
84 TrafficStats.tagFileDescriptor(sock); in openUdp6Sock()
85 Os.bind(sock, INADDR_ANY, 0); in openUdp6Sock()
86 applySocketConfig(sockConfig, sock, true /* isIpv6 */); in openUdp6Sock()
88 return sock; in openUdp6Sock()
/packages/modules/Bluetooth/tools/rootcanal/test/
Dposix_socket_unittest.cc84 [&](std::shared_ptr<AsyncDataChannel> sock, AsyncDataChannelServer*) { in connectPair() argument
86 sock1 = std::move(sock); in connectPair()
198 sock2->WatchForNonBlockingRead([&](auto sock) { in TEST_F() argument
202 sock->StopWatching(); in TEST_F()
245 pass_.SetOnConnectCallback([&](std::shared_ptr<AsyncDataChannel> const& sock, in TEST_F()
248 connections.push_back(sock); in TEST_F()
275 [&](std::shared_ptr<AsyncDataChannel> sock, AsyncDataChannelServer*) { in TEST_F() argument
277 connections.push_back(sock); in TEST_F()
/packages/modules/Connectivity/tests/unit/java/android/net/
DNetworkUtilsTest.java162 private void testSetSockOptBytes(FileDescriptor sock, long timeValMillis) in testSetSockOptBytes() argument
168 NetworkUtils.setsockoptBytes(sock, SOL_SOCKET, SO_RCVTIMEO, timeval); in testSetSockOptBytes()
169 readTimeval = Os.getsockoptTimeval(sock, SOL_SOCKET, SO_RCVTIMEO); in testSetSockOptBytes()
176 final FileDescriptor sock = Os.socket(AF_INET6, SOCK_DGRAM, IPPROTO_ICMPV6); in testSetSockOptBytes() local
178 testSetSockOptBytes(sock, 3000); in testSetSockOptBytes()
180 testSetSockOptBytes(sock, 5000); in testSetSockOptBytes()
182 SocketUtils.closeSocketQuietly(sock); in testSetSockOptBytes()
/packages/services/Car/tools/emulator/
Dvhal_emulator.py121 self.sock.sendall(msgHdr)
123 self.sock.sendall(msgStr)
146 self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
147 self.sock.connect(('localhost', localPortNumber))
156 b = self.sock.recv(4)
161 b = self.sock.recv(msgLen)
/packages/modules/StatsD/statsd/src/socket/
DStatsSocketListener.cpp224 int sock = android_get_control_socket(socketName); in getLogSocket() local
226 if (sock < 0) { // statsd started up in init.sh in getLogSocket()
227 sock = socket_local_server(socketName, ANDROID_SOCKET_NAMESPACE_RESERVED, SOCK_DGRAM); in getLogSocket()
230 if (setsockopt(sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on))) { in getLogSocket()
234 return sock; in getLogSocket()
/packages/modules/DnsResolver/
Dresolv_private.h126 for (auto& sock : udpsocks) { in closeSockets()
127 sock.reset(); in closeSockets()
237 inline void resolv_tag_socket(int sock, uid_t uid, pid_t pid) { in resolv_tag_socket() argument
240 if (int err = android::net::gResNetdCallbacks.tagSocket(sock, TAG_SYSTEM_DNS, uid, pid)) { in resolv_tag_socket()
246 if (fchown(sock, (android::net::gApiLevel >= 30) ? uid : AID_DNS, -1) == -1) { in resolv_tag_socket()
Dres_send.cpp167 static int connect_with_timeout(int sock, const struct sockaddr* nsap, socklen_t salen,
169 static int retrying_poll(const int sock, short events, const struct timespec* finish);
917 static int connect_with_timeout(int sock, const sockaddr* nsap, socklen_t salen, in connect_with_timeout() argument
921 origflags = fcntl(sock, F_GETFL, 0); in connect_with_timeout()
922 fcntl(sock, F_SETFL, origflags | O_NONBLOCK); in connect_with_timeout()
924 res = connect(sock, nsap, salen); in connect_with_timeout()
932 LOG(DEBUG) << __func__ << ": " << sock << " send_vc"; in connect_with_timeout()
933 res = retrying_poll(sock, POLLIN | POLLOUT, &finish); in connect_with_timeout()
939 fcntl(sock, F_SETFL, origflags); in connect_with_timeout()
940 LOG(INFO) << __func__ << ": " << sock << " connect_with_const timeout returning " << res; in connect_with_timeout()
[all …]
/packages/modules/Virtualization/virtualizationservice/vmnic/src/
Daidl.rs111 let sock = socket(AddressFamily::Inet, SockType::Datagram, SockFlag::empty(), None) in createTapInterface() localVariable
114 create_tap_interface(tunfd.as_raw_fd(), sock.as_raw_fd(), ifname_bytes) in createTapInterface()
131 let sock = socket(AddressFamily::Inet, SockType::Datagram, SockFlag::empty(), None) in deleteTapInterface() localVariable
134 delete_tap_interface(tap, sock.as_raw_fd(), &mut tap_ifreq) in deleteTapInterface()
/packages/modules/Connectivity/thread/tests/utils/src/android/net/thread/utils/
DTapTestNetworkTracker.java182 FileDescriptor sock = Os.socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); in hasUsableAddress() local
183 network.bindSocket(sock); in hasUsableAddress()
184 Os.connect(sock, parseNumericAddress("ff02::fb%" + interfaceName), 12345); in hasUsableAddress()
185 Os.close(sock); in hasUsableAddress()
/packages/modules/adb/
Dtest_adb.py66 def _handle(sock): argument
67 with contextlib.closing(sock) as serversock:
316 def _reset_socket_on_close(self, sock): argument
323 sock.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER,
326 linger = sock.getsockopt(socket.SOL_SOCKET, socket.SO_LINGER, 16)
404 socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:
405 sock.connect(("localhost", server_port))
407 sock.sendall(b"%04x%s" % (len(command), command))
501 with fake_adbd() as (port, sock):
513 sock.sendall(packet)

123