Bug 1161020: Remove old interface and implementation from socket-connector classes, r=kmachulis
authorThomas Zimmermann <tdz@users.sourceforge.net>
Tue, 19 May 2015 13:28:46 +0200
changeset 244517 3529de81a66875b22d105c3b269baf9d8930b2a5
parent 244516 6d5e774afa38ddaeaf6f42e4661584c4de011c28
child 244518 d1d619fb561e12a895b46a175185866f0e72c42a
push id28782
push userkwierso@gmail.com
push dateTue, 19 May 2015 23:42:58 +0000
treeherdermozilla-central@ac277e615f8f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmachulis
bugs1161020
milestone41.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1161020: Remove old interface and implementation from socket-connector classes, r=kmachulis
dom/bluetooth/bluedroid/BluetoothDaemonConnector.cpp
dom/bluetooth/bluedroid/BluetoothDaemonConnector.h
dom/bluetooth/bluez/BluetoothUnixSocketConnector.cpp
dom/bluetooth/bluez/BluetoothUnixSocketConnector.h
ipc/keystore/KeyStoreConnector.cpp
ipc/keystore/KeyStoreConnector.h
ipc/nfc/NfcConnector.cpp
ipc/nfc/NfcConnector.h
ipc/ril/RilConnector.cpp
ipc/ril/RilConnector.h
ipc/unixsocket/UnixSocketConnector.cpp
ipc/unixsocket/UnixSocketConnector.h
--- a/dom/bluetooth/bluedroid/BluetoothDaemonConnector.cpp
+++ b/dom/bluetooth/bluedroid/BluetoothDaemonConnector.cpp
@@ -166,72 +166,9 @@ BluetoothDaemonConnector::CreateStreamSo
                                              socklen_t* aAddressLength,
                                              int& aStreamFd)
 {
   MOZ_CRASH("|BluetoothDaemonConnector| does not support "
             "creating stream sockets.");
   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
--- a/dom/bluetooth/bluedroid/BluetoothDaemonConnector.h
+++ b/dom/bluetooth/bluedroid/BluetoothDaemonConnector.h
@@ -35,28 +35,16 @@ public:
                               struct sockaddr* aAddress,
                               socklen_t* aAddressLen,
                               int& aStreamFd) override;
 
   nsresult CreateStreamSocket(struct sockaddr* aAddress,
                               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;
   nsresult CreateAddress(struct sockaddr& aAddress,
                          socklen_t& aAddressLength) const;
 
   nsCString mSocketName;
 };
--- a/dom/bluetooth/bluez/BluetoothUnixSocketConnector.cpp
+++ b/dom/bluetooth/bluez/BluetoothUnixSocketConnector.cpp
@@ -37,38 +37,16 @@ using namespace mozilla::ipc;
 
 BEGIN_BLUETOOTH_NAMESPACE
 
 static const int RFCOMM_SO_SNDBUF = 70 * 1024;  // 70 KB send buffer
 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,
   int aChannel,
   bool aAuth,
   bool aEncrypt)
   : mAddressString(aAddressString)
   , mType(aType)
@@ -425,218 +403,9 @@ BluetoothUnixSocketConnector::CreateStre
     }
   }
 
   aStreamFd = fd.forget();
 
   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
--- a/dom/bluetooth/bluez/BluetoothUnixSocketConnector.h
+++ b/dom/bluetooth/bluez/BluetoothUnixSocketConnector.h
@@ -36,28 +36,16 @@ public:
                               struct sockaddr* aAddress,
                               socklen_t* aAddressLen,
                               int& aStreamFd) override;
 
   nsresult CreateStreamSocket(struct sockaddr* aAddress,
                               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;
   nsresult CreateAddress(struct sockaddr& aAddress,
                          socklen_t& aAddressLength) const;
   static nsresult ConvertAddressString(const char* aAddressString,
                                        bdaddr_t& aAddress);
 
--- a/ipc/keystore/KeyStoreConnector.cpp
+++ b/ipc/keystore/KeyStoreConnector.cpp
@@ -217,100 +217,10 @@ nsresult
 KeyStoreConnector::CreateStreamSocket(struct sockaddr* aAddress,
                                       socklen_t* aAddressLength,
                                       int& aStreamFd)
 {
   MOZ_CRASH("|KeyStoreConnector| does not support creating stream sockets.");
   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!");
-}
-
 }
 }
--- a/ipc/keystore/KeyStoreConnector.h
+++ b/ipc/keystore/KeyStoreConnector.h
@@ -34,28 +34,16 @@ public:
                               struct sockaddr* aAddress,
                               socklen_t* aAddressLength,
                               int& aStreamFd) override;
 
   nsresult CreateStreamSocket(struct sockaddr* aAddress,
                               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;
   nsresult CheckPermission(int aFd) const;
   nsresult CreateAddress(struct sockaddr& aAddress,
                          socklen_t& aAddressLength) const;
 
   const char** const mAllowedUsers;
--- a/ipc/nfc/NfcConnector.cpp
+++ b/ipc/nfc/NfcConnector.cpp
@@ -185,76 +185,10 @@ NfcConnector::CreateStreamSocket(struct 
     }
   }
 
   aStreamFd = fd.forget();
 
   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!");
-}
-
 }
 }
--- a/ipc/nfc/NfcConnector.h
+++ b/ipc/nfc/NfcConnector.h
@@ -38,28 +38,16 @@ public:
                               struct sockaddr* aAddress,
                               socklen_t* aAddressLen,
                               int& aStreamFd) override;
 
   nsresult CreateStreamSocket(struct sockaddr* aAddress,
                               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;
   nsresult CreateAddress(struct sockaddr& aAddress,
                          socklen_t& aAddressLength) const;
 
   nsCString mAddressString;
 };
--- a/ipc/ril/RilConnector.cpp
+++ b/ipc/ril/RilConnector.cpp
@@ -199,94 +199,10 @@ RilConnector::CreateStreamSocket(struct 
     }
   }
 
   aStreamFd = fd.forget();
 
   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!");
-}
-
 }
 }
--- a/ipc/ril/RilConnector.h
+++ b/ipc/ril/RilConnector.h
@@ -38,28 +38,16 @@ public:
                               struct sockaddr* aAddress,
                               socklen_t* aAddressLen,
                               int& aStreamFd) override;
 
   nsresult CreateStreamSocket(struct sockaddr* aAddress,
                               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;
   nsresult CreateAddress(int aDomain,
                          struct sockaddr& aAddress,
                          socklen_t& aAddressLength) const;
 
   nsCString mAddressString;
--- a/ipc/unixsocket/UnixSocketConnector.cpp
+++ b/ipc/unixsocket/UnixSocketConnector.cpp
@@ -10,44 +10,10 @@ namespace mozilla {
 namespace ipc {
 
 UnixSocketConnector::UnixSocketConnector()
 { }
 
 UnixSocketConnector::~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.");
-}
-
 }
 }
--- a/ipc/unixsocket/UnixSocketConnector.h
+++ b/ipc/unixsocket/UnixSocketConnector.h
@@ -31,116 +31,55 @@ public:
    *
    * @param aAddress A socket address
    * @param aAddressLength The number of valid bytes in |aAddress|
    * @param[out] aAddressString The resulting string
    * @return NS_OK on success, or an XPCOM error code otherwise.
    */
   virtual nsresult ConvertAddressToString(const struct sockaddr& aAddress,
                                           socklen_t aAddressLength,
-                                          nsACString& aAddressString);
+                                          nsACString& aAddressString) = 0;
 
   /**
    * Creates a listening socket. I/O thread only.
    *
    * @param[out] aAddress The listening socket's address
    * @param[out] aAddressLength The number of valid bytes in |aAddress|
    * @param[out] aListenFd The socket's file descriptor
    * @return NS_OK on success, or an XPCOM error code otherwise.
    */
   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.
    *
    * @param aListenFd The listening socket
    * @param[out] aAddress Returns the stream socket's address
    * @param[out] aAddressLength Returns the number of valid bytes in |aAddress|
    * @param[out] aStreamFd The stream socket's file descriptor
    * @return NS_OK on success, or an XPCOM error code otherwise.
    */
   virtual nsresult AcceptStreamSocket(int aListenFd,
                                       struct sockaddr* aAddress,
                                       socklen_t* aAddressLen,
-                                      int& aStreamFd);
+                                      int& aStreamFd) = 0;
 
   /**
    * Creates a stream socket. I/O thread only.
    *
    * @param[in|out] aAddress The stream socket's address
    * @param[in|out] aAddressLength The number of valid bytes in |aAddress|
    * @param[out] aStreamFd The socket's file descriptor
    * @return NS_OK on success, or an XPCOM error code otherwise.
    */
   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();
 };
 
 }
 }