Bug 1161020: Remove old interface and implementation from socket-connector classes, r=kmachulis

This commit is contained in:
Thomas Zimmermann 2015-05-18 11:28:30 +02:00
parent aeb7412df4
commit cebb47d1cc
12 changed files with 4 additions and 698 deletions

View File

@ -8,7 +8,6 @@
#include "BluetoothDaemonConnector.h"
#include <fcntl.h>
#include "nsISupportsImpl.h"
#include "nsThreadUtils.h"
BEGIN_BLUETOOTH_NAMESPACE
@ -176,67 +175,4 @@ BluetoothDaemonConnector::CreateStreamSocket(struct sockaddr* aAddress,
return NS_ERROR_ABORT;
}
// Deprecated
int
BluetoothDaemonConnector::Create()
{
MOZ_ASSERT(!NS_IsMainThread());
int fd = socket(AF_UNIX, SOCK_SEQPACKET, 0);
if (fd < 0) {
BT_WARNING("Could not open socket!");
return -1;
}
return fd;
}
bool
BluetoothDaemonConnector::CreateAddr(bool aIsServer,
socklen_t& aAddrSize,
mozilla::ipc::sockaddr_any& aAddr,
const char* aAddress)
{
static const size_t sNameOffset = 1;
size_t namesiz = mSocketName.Length() + 1; /* include trailing '\0' */
if ((sNameOffset + namesiz) > sizeof(aAddr.un.sun_path)) {
BT_WARNING("Address too long for socket struct!");
return false;
}
memset(aAddr.un.sun_path, '\0', sNameOffset); // abstract socket
memcpy(aAddr.un.sun_path + sNameOffset, mSocketName.get(), namesiz);
aAddr.un.sun_family = AF_UNIX;
aAddrSize = offsetof(struct sockaddr_un, sun_path) + sNameOffset + namesiz;
return true;
}
bool
BluetoothDaemonConnector::SetUp(int aFd)
{
if (TEMP_FAILURE_RETRY(fcntl(aFd, F_SETFL, O_NONBLOCK)) < 0) {
BT_WARNING("Failed to set non-blocking I/O.");
return false;
}
return true;
}
bool
BluetoothDaemonConnector::SetUpListenSocket(int aFd)
{
return true;
}
void
BluetoothDaemonConnector::GetSocketAddr(
const mozilla::ipc::sockaddr_any& aAddr, nsAString& aAddrStr)
{
// Unused.
MOZ_CRASH("This should never be called!");
}
END_BLUETOOTH_NAMESPACE

View File

@ -40,18 +40,6 @@ public:
socklen_t* aAddressLength,
int& aStreamFd) override;
// Deprecated
int Create() override;
bool CreateAddr(bool aIsServer,
socklen_t& aAddrSize,
mozilla::ipc::sockaddr_any& aAddr,
const char* aAddress) override;
bool SetUp(int aFd) override;
bool SetUpListenSocket(int aFd) override;
void GetSocketAddr(const mozilla::ipc::sockaddr_any& aAddr,
nsAString& aAddrStr) override;
private:
nsresult CreateSocket(int& aFd) const;
nsresult SetSocketFlags(int aFd) const;

View File

@ -32,7 +32,6 @@
#include <sys/socket.h>
#include <unistd.h>
#include "nsISupportsImpl.h" // For MOZ_COUNT_CTOR, MOZ_COUNT_DTOR
#include "nsThreadUtils.h" // For NS_IsMainThread.
using namespace mozilla::ipc;
@ -43,28 +42,6 @@ static const int L2CAP_SO_SNDBUF = 400 * 1024; // 400 KB send buffer
static const int L2CAP_SO_RCVBUF = 400 * 1024; // 400 KB receive buffer
static const int L2CAP_MAX_MTU = 65000;
#ifdef MOZ_B2G_BT_BLUEZ
static
int get_bdaddr(const char *str, bdaddr_t *ba)
{
char *d = ((char*)ba) + 5, *endp;
for (int i = 0; i < 6; i++) {
*d-- = strtol(str, &endp, 16);
MOZ_ASSERT(!(*endp != ':' && i != 5));
str = endp + 1;
}
return 0;
}
static
void get_bdaddr_as_string(const bdaddr_t *ba, char *str) {
const uint8_t *b = (const uint8_t *)ba;
sprintf(str, "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
b[5], b[4], b[3], b[2], b[1], b[0]);
}
#endif
BluetoothUnixSocketConnector::BluetoothUnixSocketConnector(
const nsACString& aAddressString,
BluetoothSocketType aType,
@ -435,213 +412,4 @@ BluetoothUnixSocketConnector::CreateStreamSocket(struct sockaddr* aAddress,
return NS_OK;
}
// Deprecated
bool
BluetoothUnixSocketConnector::SetUp(int aFd)
{
#ifdef MOZ_B2G_BT_BLUEZ
int lm = 0;
int sndbuf, rcvbuf;
/* kernel does not yet support LM for SCO */
switch (mType) {
case BluetoothSocketType::RFCOMM:
lm |= mAuth ? RFCOMM_LM_AUTH : 0;
lm |= mEncrypt ? RFCOMM_LM_ENCRYPT : 0;
break;
case BluetoothSocketType::L2CAP:
case BluetoothSocketType::EL2CAP:
lm |= mAuth ? L2CAP_LM_AUTH : 0;
lm |= mEncrypt ? L2CAP_LM_ENCRYPT : 0;
break;
case BluetoothSocketType::SCO:
break;
default:
MOZ_CRASH("Unknown socket type!");
}
if (lm) {
if (mType == BluetoothSocketType::RFCOMM) {
if (setsockopt(aFd, SOL_RFCOMM, RFCOMM_LM, &lm, sizeof(lm))) {
BT_WARNING("setsockopt(RFCOMM_LM) failed, throwing");
return false;
}
} else if (mType == BluetoothSocketType::L2CAP ||
mType == BluetoothSocketType::EL2CAP) {
if (setsockopt(aFd, SOL_L2CAP, L2CAP_LM, &lm, sizeof(lm))) {
BT_WARNING("setsockopt(L2CAP_LM) failed, throwing");
return false;
}
}
}
if (mType == BluetoothSocketType::RFCOMM) {
sndbuf = RFCOMM_SO_SNDBUF;
if (setsockopt(aFd, SOL_SOCKET, SO_SNDBUF, &sndbuf, sizeof(sndbuf))) {
BT_WARNING("setsockopt(SO_SNDBUF) failed, throwing");
return false;
}
}
/* Setting L2CAP socket options */
if (mType == BluetoothSocketType::L2CAP ||
mType == BluetoothSocketType::EL2CAP) {
struct l2cap_options opts;
socklen_t optlen = sizeof(opts);
int err;
err = getsockopt(aFd, SOL_L2CAP, L2CAP_OPTIONS, &opts, &optlen);
if (!err) {
/* setting MTU for [E]L2CAP */
opts.omtu = opts.imtu = L2CAP_MAX_MTU;
/* Enable ERTM for [E]L2CAP */
if (mType == BluetoothSocketType::EL2CAP) {
opts.flush_to = 0xffff; /* infinite */
opts.mode = L2CAP_MODE_ERTM;
opts.fcs = 1;
opts.txwin_size = 64;
opts.max_tx = 10;
}
err = setsockopt(aFd, SOL_L2CAP, L2CAP_OPTIONS, &opts, optlen);
}
/* Set larger SNDBUF & RCVBUF for EL2CAP connections */
if (mType == BluetoothSocketType::EL2CAP) {
sndbuf = L2CAP_SO_SNDBUF;
if (setsockopt(aFd, SOL_SOCKET, SO_SNDBUF, &sndbuf, sizeof(sndbuf))) {
BT_WARNING("setsockopt(SO_SNDBUF) failed, throwing");
return false;
}
rcvbuf = L2CAP_SO_RCVBUF;
if (setsockopt(aFd, SOL_SOCKET, SO_RCVBUF, &rcvbuf, sizeof(rcvbuf))) {
BT_WARNING("setsockopt(SO_RCVBUF) failed, throwing");
return false;
}
}
}
#endif
return true;
}
bool
BluetoothUnixSocketConnector::SetUpListenSocket(int aFd)
{
// Nothing to do here.
return true;
}
int
BluetoothUnixSocketConnector::Create()
{
MOZ_ASSERT(!NS_IsMainThread());
int fd = -1;
#ifdef MOZ_B2G_BT_BLUEZ
switch (mType) {
case BluetoothSocketType::RFCOMM:
fd = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
break;
case BluetoothSocketType::SCO:
fd = socket(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_SCO);
break;
case BluetoothSocketType::L2CAP:
fd = socket(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP);
break;
case BluetoothSocketType::EL2CAP:
fd = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_L2CAP);
break;
default:
MOZ_CRASH();
}
if (fd < 0) {
BT_WARNING("Could not open bluetooth socket!");
return -1;
}
if (!SetUp(fd)) {
BT_WARNING("Could not set up socket!");
return -1;
}
#endif
return fd;
}
bool
BluetoothUnixSocketConnector::CreateAddr(bool aIsServer,
socklen_t& aAddrSize,
sockaddr_any& aAddr,
const char* aAddress)
{
#ifdef MOZ_B2G_BT_BLUEZ
// Set to BDADDR_ANY, if it's not a server, we'll reset.
bdaddr_t bd_address_obj = {{0, 0, 0, 0, 0, 0}};
if (!aIsServer && aAddress && strlen(aAddress) > 0) {
if (get_bdaddr(aAddress, &bd_address_obj)) {
BT_WARNING("Can't get bluetooth address!");
return false;
}
}
// Initialize
memset(&aAddr, 0, sizeof(aAddr));
switch (mType) {
case BluetoothSocketType::RFCOMM:
struct sockaddr_rc addr_rc;
aAddrSize = sizeof(addr_rc);
aAddr.rc.rc_family = AF_BLUETOOTH;
aAddr.rc.rc_channel = mChannel;
memcpy(&aAddr.rc.rc_bdaddr, &bd_address_obj, sizeof(bd_address_obj));
break;
case BluetoothSocketType::L2CAP:
case BluetoothSocketType::EL2CAP:
struct sockaddr_l2 addr_l2;
aAddrSize = sizeof(addr_l2);
aAddr.l2.l2_family = AF_BLUETOOTH;
aAddr.l2.l2_psm = mChannel;
memcpy(&aAddr.l2.l2_bdaddr, &bd_address_obj, sizeof(bdaddr_t));
break;
case BluetoothSocketType::SCO:
struct sockaddr_sco addr_sco;
aAddrSize = sizeof(addr_sco);
aAddr.sco.sco_family = AF_BLUETOOTH;
memcpy(&aAddr.sco.sco_bdaddr, &bd_address_obj, sizeof(bd_address_obj));
break;
default:
BT_WARNING("Socket type unknown!");
return false;
}
#endif
return true;
}
void
BluetoothUnixSocketConnector::GetSocketAddr(const sockaddr_any& aAddr,
nsAString& aAddrStr)
{
#ifdef MOZ_B2G_BT_BLUEZ
char addr[18];
switch (mType) {
case BluetoothSocketType::RFCOMM:
get_bdaddr_as_string((bdaddr_t*)(&aAddr.rc.rc_bdaddr), addr);
break;
case BluetoothSocketType::SCO:
get_bdaddr_as_string((bdaddr_t*)(&aAddr.sco.sco_bdaddr), addr);
break;
case BluetoothSocketType::L2CAP:
case BluetoothSocketType::EL2CAP:
get_bdaddr_as_string((bdaddr_t*)(&aAddr.l2.l2_bdaddr), addr);
break;
default:
MOZ_CRASH("Socket should be either RFCOMM or SCO!");
}
aAddrStr.AssignASCII(addr);
#endif
}
END_BLUETOOTH_NAMESPACE

View File

@ -41,18 +41,6 @@ public:
socklen_t* aAddressLength,
int& aStreamFd) override;
// Deprecated
virtual int Create() override;
virtual bool CreateAddr(bool aIsServer,
socklen_t& aAddrSize,
mozilla::ipc::sockaddr_any& aAddr,
const char* aAddress) override;
virtual bool SetUp(int aFd) override;
virtual bool SetUpListenSocket(int aFd) override;
virtual void GetSocketAddr(const mozilla::ipc::sockaddr_any& aAddr,
nsAString& aAddrStr) override;
private:
nsresult CreateSocket(int& aFd) const;
nsresult SetSocketFlags(int aFd) const;

View File

@ -11,7 +11,6 @@
#include <sys/stat.h>
#include <sys/un.h>
#include "nsISupportsImpl.h" // For MOZ_COUNT_CTOR, MOZ_COUNT_DTOR
#include "nsThreadUtils.h" // For NS_IsMainThread.
#ifdef MOZ_WIDGET_GONK
#include <android/log.h>
@ -227,95 +226,5 @@ KeyStoreConnector::CreateStreamSocket(struct sockaddr* aAddress,
return NS_ERROR_FAILURE;
}
// Deprecated
static const char* KEYSTORE_ALLOWED_USERS[] = {
"root",
"wifi",
NULL
};
static bool checkPermission(uid_t uid)
{
struct passwd *userInfo = getpwuid(uid);
for (const char **user = KEYSTORE_ALLOWED_USERS; *user; user++ ) {
if (!strcmp(*user, userInfo->pw_name)) {
return true;
}
}
return false;
}
int
KeyStoreConnector::Create()
{
MOZ_ASSERT(!NS_IsMainThread());
int fd;
unlink(KEYSTORE_SOCKET_PATH);
fd = socket(AF_LOCAL, SOCK_STREAM, 0);
if (fd < 0) {
NS_WARNING("Could not open keystore socket!");
return -1;
}
return fd;
}
bool
KeyStoreConnector::CreateAddr(bool aIsServer,
socklen_t& aAddrSize,
sockaddr_any& aAddr,
const char* aAddress)
{
// Keystore socket must be server
MOZ_ASSERT(aIsServer);
aAddr.un.sun_family = AF_LOCAL;
if(strlen(KEYSTORE_SOCKET_PATH) > sizeof(aAddr.un.sun_path)) {
NS_WARNING("Address too long for socket struct!");
return false;
}
strcpy((char*)&aAddr.un.sun_path, KEYSTORE_SOCKET_PATH);
aAddrSize = strlen(KEYSTORE_SOCKET_PATH) + offsetof(struct sockaddr_un, sun_path) + 1;
return true;
}
bool
KeyStoreConnector::SetUp(int aFd)
{
// Socket permission check.
struct ucred userCred;
socklen_t len = sizeof(struct ucred);
if (getsockopt(aFd, SOL_SOCKET, SO_PEERCRED, &userCred, &len)) {
return false;
}
return checkPermission(userCred.uid);
}
bool
KeyStoreConnector::SetUpListenSocket(int aFd)
{
// Allow access of wpa_supplicant(different user, differnt group)
chmod(KEYSTORE_SOCKET_PATH, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
return true;
}
void
KeyStoreConnector::GetSocketAddr(const sockaddr_any& aAddr,
nsAString& aAddrStr)
{
// Unused.
MOZ_CRASH("This should never be called!");
}
}
}

View File

@ -39,18 +39,6 @@ public:
socklen_t* aAddressLength,
int& aStreamFd) override;
// Deprecated
int Create();
bool CreateAddr(bool aIsServer,
socklen_t& aAddrSize,
sockaddr_any& aAddr,
const char* aAddress);
bool SetUp(int aFd);
bool SetUpListenSocket(int aFd);
void GetSocketAddr(const sockaddr_any& aAddr,
nsAString& aAddrStr);
private:
nsresult CreateSocket(int& aFd) const;
nsresult SetSocketFlags(int aFd) const;

View File

@ -9,7 +9,6 @@
#include <fcntl.h>
#include <sys/un.h>
#include "nsISupportsImpl.h" // For MOZ_COUNT_CTOR, MOZ_COUNT_DTOR
#include "nsThreadUtils.h" // For NS_IsMainThread.
namespace mozilla {
namespace ipc {
@ -195,71 +194,5 @@ NfcConnector::CreateStreamSocket(struct sockaddr* aAddress,
return NS_OK;
}
// Deprecated
int
NfcConnector::Create()
{
MOZ_ASSERT(!NS_IsMainThread());
int fd = socket(AF_LOCAL, SOCK_STREAM, 0);
if (fd < 0) {
NS_WARNING("Could not open nfc socket!");
return -1;
}
if (!SetUp(fd)) {
NS_WARNING("Could not set up socket!");
}
return fd;
}
bool
NfcConnector::CreateAddr(bool aIsServer,
socklen_t& aAddrSize,
sockaddr_any& aAddr,
const char* aAddress)
{
static const size_t sNameOffset = 1;
nsDependentCString socketName("nfcd");
size_t namesiz = socketName.Length() + 1; /* include trailing '\0' */
if ((sNameOffset + namesiz) > sizeof(aAddr.un.sun_path)) {
NS_WARNING("Address too long for socket struct!");
return false;
}
memset(aAddr.un.sun_path, '\0', sNameOffset); // abstract socket
memcpy(aAddr.un.sun_path + sNameOffset, socketName.get(), namesiz);
aAddr.un.sun_family = AF_UNIX;
aAddrSize = offsetof(struct sockaddr_un, sun_path) + sNameOffset + namesiz;
return true;
}
bool
NfcConnector::SetUp(int aFd)
{
// Nothing to do here.
return true;
}
bool
NfcConnector::SetUpListenSocket(int aFd)
{
// Nothing to do here.
return true;
}
void
NfcConnector::GetSocketAddr(const sockaddr_any& aAddr,
nsAString& aAddrStr)
{
MOZ_CRASH("This should never be called!");
}
}
}

View File

@ -43,18 +43,6 @@ public:
socklen_t* aAddressLength,
int& aStreamFd) override;
// Deprecated
int Create() override;
bool CreateAddr(bool aIsServer,
socklen_t& aAddrSize,
sockaddr_any& aAddr,
const char* aAddress) override;
bool SetUp(int aFd) override;
bool SetUpListenSocket(int aFd) override;
void GetSocketAddr(const sockaddr_any& aAddr,
nsAString& aAddrStr) override;
private:
nsresult CreateSocket(int& aFd) const;
nsresult SetSocketFlags(int aFd) const;

View File

@ -9,7 +9,6 @@
#include <fcntl.h>
#include <sys/socket.h>
#include "nsISupportsImpl.h" // For MOZ_COUNT_CTOR, MOZ_COUNT_DTOR
#include "nsThreadUtils.h" // For NS_IsMainThread.
#ifdef AF_INET
#include <arpa/inet.h>
@ -209,89 +208,5 @@ RilConnector::CreateStreamSocket(struct sockaddr* aAddress,
return NS_OK;
}
// Deprecated
int
RilConnector::Create()
{
MOZ_ASSERT(!NS_IsMainThread());
int fd = -1;
#if defined(MOZ_WIDGET_GONK)
fd = socket(AF_LOCAL, SOCK_STREAM, 0);
#else
// If we can't hit a local loopback, fail later in connect.
fd = socket(AF_INET, SOCK_STREAM, 0);
#endif
if (fd < 0) {
NS_WARNING("Could not open ril socket!");
return -1;
}
if (!SetUp(fd)) {
NS_WARNING("Could not set up socket!");
}
return fd;
}
bool
RilConnector::CreateAddr(bool aIsServer,
socklen_t& aAddrSize,
sockaddr_any& aAddr,
const char* aAddress)
{
// We never open ril socket as server.
MOZ_ASSERT(!aIsServer);
uint32_t af;
#if defined(MOZ_WIDGET_GONK)
af = AF_LOCAL;
#else
af = AF_INET;
#endif
switch (af) {
case AF_LOCAL:
aAddr.un.sun_family = af;
if(strlen(aAddress) > sizeof(aAddr.un.sun_path)) {
NS_WARNING("Address too long for socket struct!");
return false;
}
strcpy((char*)&aAddr.un.sun_path, aAddress);
aAddrSize = strlen(aAddress) + offsetof(struct sockaddr_un, sun_path) + 1;
break;
case AF_INET:
aAddr.in.sin_family = af;
aAddr.in.sin_port = htons(RIL_TEST_PORT + mClientId);
aAddr.in.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
aAddrSize = sizeof(sockaddr_in);
break;
default:
NS_WARNING("Socket type not handled by connector!");
return false;
}
return true;
}
bool
RilConnector::SetUp(int aFd)
{
// Nothing to do here.
return true;
}
bool
RilConnector::SetUpListenSocket(int aFd)
{
// Nothing to do here.
return true;
}
void
RilConnector::GetSocketAddr(const sockaddr_any& aAddr, nsAString& aAddrStr)
{
MOZ_CRASH("This should never be called!");
}
}
}

View File

@ -43,18 +43,6 @@ public:
socklen_t* aAddressLength,
int& aStreamFd) override;
// Deprecated
int Create() override;
bool CreateAddr(bool aIsServer,
socklen_t& aAddrSize,
sockaddr_any& aAddr,
const char* aAddress) override;
bool SetUp(int aFd) override;
bool SetUpListenSocket(int aFd) override;
void GetSocketAddr(const sockaddr_any& aAddr,
nsAString& aAddrStr) override;
private:
nsresult CreateSocket(int aDomain, int& aFd) const;
nsresult SetSocketFlags(int aFd) const;

View File

@ -20,39 +20,5 @@ UnixSocketConnector::~UnixSocketConnector()
MOZ_COUNT_DTOR(UnixSocketConnector);
}
nsresult
UnixSocketConnector::ConvertAddressToString(const struct sockaddr& aAddress,
socklen_t aAddressLength,
nsACString& aAddressString)
{
MOZ_CRASH("|UnixSocketConnector| does not convert addresses to strings.");
return NS_ERROR_ABORT;
}
nsresult
UnixSocketConnector::CreateListenSocket(struct sockaddr* aAddress,
socklen_t* aAddressLength,
int& aListenFd)
{
MOZ_CRASH("|UnixSocketConnector| does not support listening sockets.");
}
nsresult
UnixSocketConnector::AcceptStreamSocket(int aListenFd,
struct sockaddr* aAddress,
socklen_t* aAddressLen,
int& aStreamFd)
{
MOZ_CRASH("|UnixSocketConnector| does not support accepting stream sockets.");
}
nsresult
UnixSocketConnector::CreateStreamSocket(struct sockaddr* aAddress,
socklen_t* aAddressLength,
int& aStreamFd)
{
MOZ_CRASH("|UnixSocketConnector| does not support creating stream sockets.");
}
}
}

View File

@ -36,7 +36,7 @@ public:
*/
virtual nsresult ConvertAddressToString(const struct sockaddr& aAddress,
socklen_t aAddressLength,
nsACString& aAddressString);
nsACString& aAddressString) = 0;
/**
* Creates a listening socket. I/O thread only.
@ -48,7 +48,7 @@ public:
*/
virtual nsresult CreateListenSocket(struct sockaddr* aAddress,
socklen_t* aAddressLength,
int& aListenFd);
int& aListenFd) = 0;
/**
* Accepts a stream socket from a listening socket. I/O thread only.
@ -62,7 +62,7 @@ public:
virtual nsresult AcceptStreamSocket(int aListenFd,
struct sockaddr* aAddress,
socklen_t* aAddressLen,
int& aStreamFd);
int& aStreamFd) = 0;
/**
* Creates a stream socket. I/O thread only.
@ -74,68 +74,7 @@ public:
*/
virtual nsresult CreateStreamSocket(struct sockaddr* aAddress,
socklen_t* aAddressLength,
int& aStreamFd);
/**
* Establishs a file descriptor for a socket.
*
* @deprecated
*
* @return File descriptor for socket
*/
virtual int Create() = 0;
/**
* Since most socket specifics are related to address formation into a
* sockaddr struct, this function is defined by subclasses and fills in the
* structure as needed for whatever connection it is trying to build
*
* @deprecated
*
* @param aIsServer True is we are acting as a server socket
* @param aAddrSize Size of the struct
* @param aAddr Struct to fill
* @param aAddress If aIsServer is false, Address to connect to. nullptr otherwise.
*
* @return True if address is filled correctly, false otherwise
*/
virtual bool CreateAddr(bool aIsServer,
socklen_t& aAddrSize,
sockaddr_any& aAddr,
const char* aAddress) = 0;
/**
* Does any socket type specific setup that may be needed, only for socket
* created by ConnectSocket()
*
* @param aFd File descriptor for opened socket
*
* @return true is successful, false otherwise
*/
virtual bool SetUp(int aFd) = 0;
/**
* Perform socket setup for socket created by ListenSocket(), after listen().
*
* @deprecated
*
* @param aFd File descriptor for opened socket
*
* @return true is successful, false otherwise
*/
virtual bool SetUpListenSocket(int aFd) = 0;
/**
* Get address of socket we're currently connected to. Return null string if
* not connected.
*
* @deprecated
*
* @param aAddr Address struct
* @param aAddrStr String to store address to
*/
virtual void GetSocketAddr(const sockaddr_any& aAddr,
nsAString& aAddrStr) = 0;
int& aStreamFd) = 0;
protected:
UnixSocketConnector();