Home
last modified time | relevance | path

Searched refs:socket (Results 1 – 25 of 251) sorted by relevance

1234567891011

/packages/modules/Bluetooth/system/osi/src/
Dsocket.cc56 ret->fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); in socket_new()
85 void socket_free(socket_t* socket) { in socket_free() argument
86 if (!socket) return; in socket_free()
88 socket_unregister(socket); in socket_free()
89 close(socket->fd); in socket_free()
90 osi_free(socket); in socket_free()
93 bool socket_listen(const socket_t* socket, port_t port) { in socket_listen() argument
94 CHECK(socket != NULL); in socket_listen()
100 if (bind(socket->fd, (struct sockaddr*)&addr, sizeof(addr)) == -1) { in socket_listen()
106 if (listen(socket->fd, 10) == -1) { in socket_listen()
[all …]
/packages/modules/Bluetooth/system/test/mock/
Dmock_osi_socket.h64 std::function<socket_t*(const socket_t* socket)> body{
65 [this](const socket_t* socket) { return return_value; }};
66 socket_t* operator()(const socket_t* socket) { return body(socket); }; in operator()
75 std::function<ssize_t(const socket_t* socket)> body{
76 [this](const socket_t* socket) { return return_value; }};
77 ssize_t operator()(const socket_t* socket) { return body(socket); }; in operator()
85 std::function<void(socket_t* socket)> body{[](socket_t* socket) {}};
86 void operator()(socket_t* socket) { body(socket); }; in operator()
95 std::function<bool(const socket_t* socket, port_t port)> body{
96 [this](const socket_t* socket, port_t port) { return return_value; }};
[all …]
Dmock_osi_socket.cc56 socket_t* socket_accept(const socket_t* socket) { in socket_accept() argument
58 return test::mock::osi_socket::socket_accept(socket); in socket_accept()
60 ssize_t socket_bytes_available(const socket_t* socket) { in socket_bytes_available() argument
62 return test::mock::osi_socket::socket_bytes_available(socket); in socket_bytes_available()
64 void socket_free(socket_t* socket) { in socket_free() argument
66 test::mock::osi_socket::socket_free(socket); in socket_free()
68 bool socket_listen(const socket_t* socket, port_t port) { in socket_listen() argument
70 return test::mock::osi_socket::socket_listen(socket, port); in socket_listen()
80 ssize_t socket_read(const socket_t* socket, void* buf, size_t count) { in socket_read() argument
82 return test::mock::osi_socket::socket_read(socket, buf, count); in socket_read()
[all …]
/packages/modules/Connectivity/tests/cts/net/src/android/net/cts/
DSSLCertificateSocketFactoryTest.java134 Socket socket = new Socket(); in createSocket_io_error_expected() local
135 mSocketFactory.createSocket(socket, "localhost", HTTPS_PORT, true); in createSocket_io_error_expected()
174 Socket socket = mSocketFactory.createSocket(TEST_HOST, HTTPS_PORT); in createSocket_simple_with_hostname_verification() local
175 assertConnectedSocket(socket); in createSocket_simple_with_hostname_verification()
176 socket.close(); in createSocket_simple_with_hostname_verification()
202 Socket socket = mSocketFactory.createSocket(underlying, TEST_HOST, HTTPS_PORT, true); in createSocket_wrapped_with_hostname_verification() local
203 assertConnectedSocket(socket); in createSocket_wrapped_with_hostname_verification()
204 socket.close(); in createSocket_wrapped_with_hostname_verification()
231 Socket socket = mSocketFactory.createSocket(TEST_HOST, HTTPS_PORT, mLocalAddress, 0); in createSocket_bound_with_hostname_verification() local
232 assertConnectedSocket(socket); in createSocket_bound_with_hostname_verification()
[all …]
DVpnServiceTest.java68 DatagramSocket socket = new DatagramSocket(); in testProtect_DatagramSocket() local
71 assertFalse(mVpnService.protect(socket)); in testProtect_DatagramSocket()
74 socket.close(); in testProtect_DatagramSocket()
83 Socket socket = new Socket(); in testProtect_Socket() local
86 assertFalse(mVpnService.protect(socket)); in testProtect_Socket()
89 socket.close(); in testProtect_Socket()
98 DatagramSocket socket = new DatagramSocket(); in testProtect_int() local
99 ParcelFileDescriptor descriptor = ParcelFileDescriptor.fromDatagramSocket(socket); in testProtect_int()
110 socket.close(); in testProtect_int()
/packages/modules/Connectivity/tests/unit/java/android/net/
DQosSocketFilterTest.java103 DatagramSocket socket = new DatagramSocket(new InetSocketAddress("127.0.0.1", 0)); in testProtocolMatch() local
104 socket.connect(new InetSocketAddress("127.0.0.1", socket.getLocalPort() + 10)); in testProtocolMatch()
107 QosSocketInfo socketInfo = new QosSocketInfo(mNetwork, socket); in testProtocolMatch()
115 socket.close(); in testProtocolMatch()
121 DatagramSocket socket = new DatagramSocket(new InetSocketAddress("127.0.0.1", 0)); in testValidate() local
122 socket.connect(new InetSocketAddress("127.0.0.1", socket.getLocalPort() + 7)); in testValidate()
125 QosSocketInfo socketInfo = new QosSocketInfo(mNetwork, socket); in testValidate()
131 socket.close(); in testValidate()
137 DatagramSocket socket; in testValidateUnbind() local
138 socket = new DatagramSocket(null); in testValidateUnbind()
[all …]
DQosSocketInfoTest.java61 Socket socket = new Socket(serverAddr.getAddress(), server.getLocalPort(), in testConstructWithSock() local
65 QosSocketInfo sockInfo = new QosSocketInfo(mMockNetwork, socket); in testConstructWithSock()
68 .equals(new InetSocketAddress(socket.getLocalAddress(), socket.getLocalPort()))); in testConstructWithSock()
70 .equals((InetSocketAddress) socket.getRemoteSocketAddress())); in testConstructWithSock()
77 socket.close(); in testConstructWithSock()
89 DatagramSocket socket = new DatagramSocket(null); in testConstructWithDatagramSock() local
90 socket.setReuseAddress(true); in testConstructWithDatagramSock()
91 socket.bind(clientAddr); in testConstructWithDatagramSock()
92 socket.connect(serverAddr); in testConstructWithDatagramSock()
97 QosSocketInfo sockInfo = new QosSocketInfo(mMockNetwork, socket); in testConstructWithDatagramSock()
[all …]
/packages/modules/Connectivity/service-t/src/com/android/server/connectivity/mdns/
DMdnsMultinetworkSocketClient.java76 @NonNull MdnsInterfaceSocket socket, @NonNull List<LinkAddress> addresses) { in onSocketCreated() argument
79 ReadPacketHandler handler = mSocketPacketHandlers.get(socket); in onSocketCreated()
82 handler = new ReadPacketHandler(network, socket.getInterface().getIndex()); in onSocketCreated()
83 mSocketPacketHandlers.put(socket, handler); in onSocketCreated()
85 socket.addPacketHandler(handler); in onSocketCreated()
86 mActiveNetworkSockets.put(socket, network); in onSocketCreated()
92 @NonNull MdnsInterfaceSocket socket) { in onInterfaceDestroyed() argument
93 notifySocketDestroyed(socket); in onInterfaceDestroyed()
94 maybeCleanupPacketHandler(socket); in onInterfaceDestroyed()
97 private void notifySocketDestroyed(@NonNull MdnsInterfaceSocket socket) { in notifySocketDestroyed() argument
[all …]
DMdnsAdvertiser.java83 public MdnsInterfaceAdvertiser makeAdvertiser(@NonNull MdnsInterfaceSocket socket, in makeAdvertiser() argument
90 return new MdnsInterfaceAdvertiser(socket, initialAddresses, looper, in makeAdvertiser()
170 public void onDestroyed(@NonNull MdnsInterfaceSocket socket) {
172 if (mAdvertiserRequests.valueAt(i).onAdvertiserDestroyed(socket)) {
176 mAllAdvertisers.remove(socket);
223 boolean onAdvertiserDestroyed(@NonNull MdnsInterfaceSocket socket) { in onAdvertiserDestroyed() argument
224 mAdvertisers.remove(socket); in onAdvertiserDestroyed()
290 @NonNull MdnsInterfaceSocket socket, in onSocketCreated() argument
292 MdnsInterfaceAdvertiser advertiser = mAllAdvertisers.get(socket); in onSocketCreated()
294 advertiser = mDeps.makeAdvertiser(socket, addresses, mLooper, mPacketCreationBuffer, in onSocketCreated()
[all …]
DMdnsSocketClient.java411 private void receiveThreadMain(byte[] receiverBuffer, @Nullable MdnsSocket socket) { in receiveThreadMain() argument
419 if (socket != null && (socket == multicastSocket || socket == unicastSocket)) { in receiveThreadMain()
420 socket.receive(packet); in receiveThreadMain()
425 String responseType = socket == multicastSocket ? MULTICAST_TYPE : UNICAST_TYPE; in receiveThreadMain()
429 /* interfaceIndex= */ (socket == null || !propagateInterfaceIndex) in receiveThreadMain()
431 : socket.getInterfaceIndex(), in receiveThreadMain()
432 /* network= */ socket.getNetwork()); in receiveThreadMain()
475 private void sendPackets(List<DatagramPacket> packets, MdnsSocket socket) { in sendPackets() argument
476 String requestType = socket == multicastSocket ? "multicast" : "unicast"; in sendPackets()
483 socket.send(packet); in sendPackets()
[all …]
/packages/modules/Connectivity/framework/src/android/net/
DNetwork.java208 Socket socket = createSocket(); in connectToHost() local
211 if (localAddress != null) socket.bind(localAddress); in connectToHost()
212 socket.connect(new InetSocketAddress(hostAddresses[i], port)); in connectToHost()
214 return socket; in connectToHost()
216 if (failed) IoUtils.closeQuietly(socket); in connectToHost()
234 Socket socket = createSocket(); in createSocket() local
237 socket.bind(new InetSocketAddress(localAddress, localPort)); in createSocket()
238 socket.connect(new InetSocketAddress(address, port)); in createSocket()
241 if (failed) IoUtils.closeQuietly(socket); in createSocket()
243 return socket; in createSocket()
[all …]
DQosSocketInfo.java124 public QosSocketInfo(@NonNull final Network network, @NonNull final Socket socket) in QosSocketInfo() argument
126 Objects.requireNonNull(socket, "socket cannot be null"); in QosSocketInfo()
129 mParcelFileDescriptor = ParcelFileDescriptor.fromSocket(socket); in QosSocketInfo()
131 new InetSocketAddress(socket.getLocalAddress(), socket.getLocalPort()); in QosSocketInfo()
134 if (socket.isConnected()) { in QosSocketInfo()
135 mRemoteSocketAddress = (InetSocketAddress) socket.getRemoteSocketAddress(); in QosSocketInfo()
148 public QosSocketInfo(@NonNull final Network network, @NonNull final DatagramSocket socket) in QosSocketInfo() argument
150 Objects.requireNonNull(socket, "socket cannot be null"); in QosSocketInfo()
153 mParcelFileDescriptor = ParcelFileDescriptor.fromDatagramSocket(socket); in QosSocketInfo()
155 new InetSocketAddress(socket.getLocalAddress(), socket.getLocalPort()); in QosSocketInfo()
[all …]
/packages/apps/Dialer/java/com/android/voicemail/impl/mail/
DMailTransport.java60 private Socket socket; field in MailTransport
130 socket = createSocket(); in open()
133 socket.connect(address, SOCKET_CONNECT_TIMEOUT); in open()
143 in = new BufferedInputStream(socket.getInputStream(), 1024); in open()
144 out = new BufferedOutputStream(socket.getOutputStream(), 512); in open()
145 socket.setSoTimeout(SOCKET_READ_TIMEOUT); in open()
159 socket.close(); in open()
160 socket = null; in open()
207 socket = in reopenTls()
209 .createSocket(socket, address.getHostName(), address.getPort(), true); in reopenTls()
[all …]
/packages/modules/Bluetooth/system/osi/include/
Dsocket.h30 typedef void (*socket_cb)(socket_t* socket, void* context);
46 void socket_free(socket_t* socket);
51 bool socket_listen(const socket_t* socket, port_t port);
56 socket_t* socket_accept(const socket_t* socket);
68 ssize_t socket_read(const socket_t* socket, void* buf, size_t count);
80 ssize_t socket_write(const socket_t* socket, const void* buf, size_t count);
87 ssize_t socket_write_and_transfer_fd(const socket_t* socket, const void* buf,
97 ssize_t socket_bytes_available(const socket_t* socket);
104 void socket_register(socket_t* socket, reactor_t* reactor, void* context,
109 void socket_unregister(socket_t* socket);
/packages/modules/Bluetooth/android/pandora/mmi2grpc/mmi2grpc/
D_modem.py2 import socket
8 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
11 self.socket = s
15 …self.socket.sendall(b'REM0\r\nAT+REMOTECALL=6,0,0,"' + str(phone_number).encode("utf-8") + b'",0\r…
16 self.socket.close()
20 …self.socket.sendall(b'REM0\r\nAT+REMOTECALL=4,0,0,"' + str(phone_number).encode("utf-8") + b'",129…
24 …self.socket.sendall(b'REM0\r\nAT+REMOTECALL=0,0,0,"' + str(phone_number).encode("utf-8") + b'",129…
/packages/modules/adb/
Dtest_adb.py27 import socket
40 with socket.socket() as s:
45 def fake_adbd(protocol=socket.AF_INET, port=0):
48 serversock = socket.socket(protocol, socket.SOCK_STREAM)
49 serversock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
50 if protocol == socket.AF_INET:
57 readsock, writesock = socket.socketpair()
88 ready.shutdown(socket.SHUT_RDWR)
323 sock.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER,
326 linger = sock.getsockopt(socket.SOL_SOCKET, socket.SO_LINGER, 16)
[all …]
/packages/modules/Bluetooth/tools/rootcanal/model/setup/
Dtest_channel_transport.cc46 void TestChannelTransport::OnCommandReady(AsyncDataChannel* socket, in OnCommandReady() argument
49 ssize_t bytes_read = socket->Recv(&command_name_size, 1); in OnCommandReady()
53 socket->Close(); in OnCommandReady()
57 bytes_read = socket->Recv(command_name_raw.data(), command_name_size); in OnCommandReady()
67 socket->Close(); in OnCommandReady()
72 bytes_read = socket->Recv(&num_args, 1); in OnCommandReady()
80 bytes_read = socket->Recv(&arg_size, 1); in OnCommandReady()
87 bytes_read = socket->Recv(arg.data(), arg_size); in OnCommandReady()
99 std::shared_ptr<AsyncDataChannel> socket, const std::string& response) { in SendResponse() argument
109 ssize_t written = socket->Send(size_buf, 4); in SendResponse()
[all …]
/packages/modules/Bluetooth/system/btif/src/
Dbtif_sock_sco.cc58 socket_t* socket; member
66 static void sco_socket_free_locked(sco_socket_t* socket);
72 static void socket_read_ready_cb(socket_t* socket, void* context);
132 socket_t* socket = NULL; in sco_socket_establish_locked() local
156 socket = socket_new_from_fd(pair[1]); in sco_socket_establish_locked()
157 if (!socket) { in sco_socket_establish_locked()
164 sco_socket->socket = socket; // Hang on to the other end. in sco_socket_establish_locked()
167 socket_register(socket, thread_get_reactor(thread), sco_socket, in sco_socket_establish_locked()
193 socket_free(sco_socket->socket); in sco_socket_free_locked()
254 if (socket_write_and_transfer_fd(sco_socket->socket, &connect_signal, in connection_request_cb()
[all …]
/packages/modules/Connectivity/nearby/tests/robotests/src/com/android/libraries/testing/deviceshadower/shadows/bluetooth/
DShadowBluetoothServerSocket.java65 BluetoothSocket socket = Shadow.directlyOn(mRealServerSocket, BluetoothServerSocket.class, in accept() local
69 String remoteAddress = socket.getRemoteDevice().getAddress(); in accept()
70 ShadowLocalSocket shadowLocalSocket = getLocalSocketShadow(socket); in accept()
75 return socket; in accept()
86 BluetoothSocket socket = ReflectionHelpers.getField(mRealServerSocket, "mSocket"); in getServerSocketFileDescriptor() local
87 ParcelFileDescriptor pfd = ReflectionHelpers.getField(socket, "mPfd"); in getServerSocketFileDescriptor()
96 BluetoothSocket socket = ReflectionHelpers.getField(mRealServerSocket, "mSocket"); in getPort() local
97 return ReflectionHelpers.getField(socket, "mPort"); in getPort()
100 private ShadowLocalSocket getLocalSocketShadow(BluetoothSocket socket) { in getLocalSocketShadow() argument
101 LocalSocket localSocket = ReflectionHelpers.getField(socket, "mSocket"); in getLocalSocketShadow()
/packages/modules/IPsec/src/java/com/android/internal/net/ipsec/ike/keepalive/
DIkeNattKeepalive.java86 mNattKeepaliveConfig.socket, in IkeNattKeepalive()
94 public final UdpEncapsulationSocket socket; field in IkeNattKeepalive.KeepaliveConfig
104 UdpEncapsulationSocket socket, in KeepaliveConfig() argument
111 this.socket = socket; in KeepaliveConfig()
145 mNattKeepaliveConfig.socket, in finishRestartingWithNewHardwareKeepalive()
175 mNattKeepaliveConfig.socket, in restart()
207 UdpEncapsulationSocket socket, in createSoftwareKeepaliveImpl() argument
209 return new SoftwareKeepaliveImpl(context, dest, socket, alarmConfig); in createSoftwareKeepaliveImpl()
225 nattKeepaliveConfig.socket, in createHardwareKeepaliveImpl()
241 UdpEncapsulationSocket socket, in HardwareKeepaliveCb() argument
[all …]
/packages/modules/Connectivity/framework/src/android/net/util/
DDnsUtils.java167 final FileDescriptor socket; in findSrcAddress() local
169 socket = Os.socket(domain, SOCK_DGRAM, IPPROTO_UDP); in findSrcAddress()
175 if (network != null) network.bindSocket(socket); in findSrcAddress()
176 Os.connect(socket, new InetSocketAddress(addr, 0)); in findSrcAddress()
177 return ((InetSocketAddress) Os.getsockname(socket)).getAddress(); in findSrcAddress()
181 IoUtils.closeQuietly(socket); in findSrcAddress()
361 final FileDescriptor socket; in checkConnectivity() local
363 socket = Os.socket(domain, SOCK_DGRAM, IPPROTO_UDP); in checkConnectivity()
368 if (network != null) network.bindSocket(socket); in checkConnectivity()
369 Os.connect(socket, addr); in checkConnectivity()
[all …]
/packages/modules/Bluetooth/system/gd/rust/linux/stack/src/
Dsocket_manager.rs4 use bt_topshim::profiles::socket;
6 use nix::sys::socket::{recvmsg, ControlMessageOwned};
35 pub type SocketType = socket::SocketType;
96 flags: flags | socket::SOCK_FLAG_NO_SDP, in make_l2cap_channel()
137 conn: socket::ConnectionComplete, in to_connecting_socket()
153 sock.fd = match socket::try_from_fd(sockfd.unwrap_or(-1)) { in to_connecting_socket()
269 fn on_incoming_socket_ready(&mut self, socket: BluetoothServerSocket, status: BtStatus); in on_incoming_socket_ready()
285 socket: Option<BluetoothSocket>, in on_outgoing_connection_result()
496 sock: Option<socket::BtSocket>,
541 self.sock = Some(socket::BtSocket::new(&intf.lock().unwrap())); in initialize()
[all …]
/packages/modules/DnsResolver/doh/connection/
Dmod.rs58 fn mark_socket(socket: &std::net::UdpSocket, socket_mark: u32) -> io::Result<()> { in mark_socket()
60 let fd = socket.as_raw_fd(); in mark_socket()
91 let socket = UdpSocket::bind(bind_addr).await?; in build_socket() localVariable
92 let std_socket = socket.into_std()?; in build_socket()
96 let socket = UdpSocket::from_std(std_socket)?; in build_socket() localVariable
97 socket.connect(peer_addr).await?; in build_socket()
98 Ok(socket) in build_socket()
143 let socket = build_socket(to, socket_mark, tag_socket).await?; in new() localVariable
144 let from = socket.local_addr()?; in new()
156 let result = drive(request_rx, status_tx, quiche_conn, socket, net_id).await; in new()
/packages/modules/NetworkStack/tests/integration/signature/android/net/util/
DNetworkStackUtilsIntegrationTest.kt122 val socket = Os.socket(AF_INET, SOCK_DGRAM or SOCK_NONBLOCK, IPPROTO_UDP) in testAddArpEntry() constant
123 SocketUtils.bindSocketToInterface(socket, iface.interfaceName) in testAddArpEntry()
126 socket) in testAddArpEntry()
144 Os.sendto(socket, originalPacket, 0 /* bytesOffset */, originalPacket.size /* bytesCount */, in testAddArpEntry()
164 val socket = Os.socket(AF_PACKET, SOCK_RAW, ETH_P_IPV6) in testAttachRaFilter() constant
168 Os.bind(socket, socketAddr) in testAttachRaFilter()
169 Os.setsockoptTimeval(socket, SOL_SOCKET, SO_RCVTIMEO, in testAttachRaFilter()
177 assertNextPacketEquals(socket, echo.readAsArray(), "ICMPv6 echo") in testAttachRaFilter()
179 NetworkStackUtils.attachRaFilter(socket, ARPHRD_ETHER) in testAttachRaFilter()
192 assertNextPacketEquals(socket, ra.readAsArray(), "ICMPv6 RA") in testAttachRaFilter()
[all …]
/packages/modules/Connectivity/tests/cts/netpermission/updatestatspermission/src/android/net/cts/network/permission/
DUpdateStatsPermissionTest.java55 Socket socket = new Socket("example.com", 80); in testUpdateDeviceStatsPermission() local
56 TrafficStats.tagSocket(socket); in testUpdateDeviceStatsPermission()
62 socket.setTcpNoDelay(true); in testUpdateDeviceStatsPermission()
63 socket.setSoLinger(true, 0); in testUpdateDeviceStatsPermission()
64 OutputStream out = socket.getOutputStream(); in testUpdateDeviceStatsPermission()
69 socket.close(); in testUpdateDeviceStatsPermission()

1234567891011