Skip to content

Commit

Permalink
[CHANGE] Combined sock and networking
Browse files Browse the repository at this point in the history
[CHANGE] Updated docs to reflect change
  • Loading branch information
tayler6000 committed Jan 15, 2024
1 parent ef89a1a commit 84203ee
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions docs/Networking.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pyVoIP.networking.nat.\ **AddressType**

.. _TransportMode:

pyVoIP.sock.transport.\ **TransportMode**
pyVoIP.networking.transport.\ **TransportMode**
TransportMode is used by pyVoIP to determine what communication protocol to use. TransportMode has the following properties:

TransportMode.\ **value**
Expand Down Expand Up @@ -80,7 +80,7 @@ VoIPSocket

The VoIPSocket class is the phone's main SIP socket. It receives and processes all new dialogs, and all messages if using :ref:`TransportMode<TransportMode>`.UDP.

*class* pyVoIP.sock.sock.\ **VoIPSocket**\ (mode: :ref:`TransportMode<TransportMode>`, bind_ip: str, bind_port: int, sip: :ref:`SIPClient`, cert_file: Optional[str] = None, key_file: Optional[str] = None, key_password: :ref:`KEY_PASSWORD<KEY_PASSWORD>` = None)
*class* pyVoIP.networking.sock.\ **VoIPSocket**\ (mode: :ref:`TransportMode<TransportMode>`, bind_ip: str, bind_port: int, sip: :ref:`SIPClient`, cert_file: Optional[str] = None, key_file: Optional[str] = None, key_password: :ref:`KEY_PASSWORD<KEY_PASSWORD>` = None)
The *TransportMode* argument is used to determine what communication protocol to use.

The *bind_ip* argument is the IP address that pyVoIP will bind its sockets to.
Expand All @@ -104,7 +104,7 @@ VoIPConnection

The VoIPConnecion class is a wrapper for Python's sockets. Since UDP, TCP, and TLS sockets all have different quarks in Python, this class consolidates everything into one interface. For UDP, VoIPConnection will pull messages from :ref:`VoIPSocket`'s database.

*class* pyVoIP.sock.sock.\ **VoIPConnection**\ (voip_sock: :ref:`VoIPSocket`, conn: Optional[:ref:`SOCKETS<SOCKETS>`, message: :ref:`SIPMessage`)
*class* pyVoIP.networking.sock.\ **VoIPConnection**\ (voip_sock: :ref:`VoIPSocket`, conn: Optional[:ref:`SOCKETS<SOCKETS>`, message: :ref:`SIPMessage`)
The *voiop_socket* argument is a :ref:`VoIPSocket` instance reference.

The *conn* argument is the underlying Python socket.
Expand Down
8 changes: 4 additions & 4 deletions pyVoIP/SIP/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from pyVoIP.credentials import CredentialsManager
from pyVoIP.helpers import Counter
from pyVoIP.networking.nat import NAT, AddressType
from pyVoIP.networking.sock import VoIPSocket
from pyVoIP.networking.transport import TransportMode
from pyVoIP.SIP.error import (
SIPParseError,
InvalidAccountInfoError,
Expand All @@ -14,7 +16,6 @@
SIPStatus,
SIPMessageType,
)
from pyVoIP.sock.transport import TransportMode
from pyVoIP.types import KEY_PASSWORD
from pyVoIP.VoIP.status import PhoneStatus
import pyVoIP
Expand All @@ -26,8 +27,8 @@

if TYPE_CHECKING:
from pyVoIP import RTP
from pyVoIP.sock import VoIPConnection
from pyVoIP.VoIP import VoIPPhone
from pyVoIP.networking.sock import VoIPConnection
from pyVoIP.VoIP.phone import VoIPPhone


debug = pyVoIP.debug
Expand Down Expand Up @@ -204,7 +205,6 @@ def parse_message(self, message: SIPMessage) -> None:
def start(self) -> None:
if self.NSD:
raise RuntimeError("Attempted to start already started SIPClient")
from pyVoIP.sock.sock import VoIPSocket

self.NSD = True
self.s = VoIPSocket(
Expand Down
2 changes: 1 addition & 1 deletion pyVoIP/VoIP/call.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

if TYPE_CHECKING:
from pyVoIP.VoIP.phone import VoIPPhone
from pyVoIP.sock.sock import VoIPConnection
from pyVoIP.networking.sock import VoIPConnection


class CallState(Enum):
Expand Down
4 changes: 2 additions & 2 deletions pyVoIP/VoIP/phone.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from pyVoIP.credentials import CredentialsManager
from pyVoIP.SIP.client import SIPClient
from pyVoIP.SIP.message import SIPMessage, SIPMessageType, SIPStatus
from pyVoIP.sock.sock import VoIPConnection
from pyVoIP.sock.transport import TransportMode
from pyVoIP.networking.sock import VoIPConnection
from pyVoIP.networking.transport import TransportMode
from pyVoIP.types import KEY_PASSWORD
from pyVoIP.VoIP.call import CallState, VoIPCall
from pyVoIP.VoIP.error import (
Expand Down
2 changes: 1 addition & 1 deletion pyVoIP/sock/sock.py → pyVoIP/networking/sock.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from pyVoIP.SIP.message import SIPMessage, SIPMessageType
from pyVoIP.SIP.error import SIPParseError
from pyVoIP.networking.nat import NAT, AddressType
from pyVoIP.sock.transport import TransportMode
from pyVoIP.networking.transport import TransportMode
import json
import math
import pprint
Expand Down
File renamed without changes.
Empty file removed pyVoIP/sock/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion tests/test_functionality.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pyVoIP.credentials import CredentialsManager
from pyVoIP.VoIP.call import CallState
from pyVoIP.VoIP.phone import PhoneStatus, VoIPPhone, VoIPPhoneParameter
from pyVoIP.sock.transport import TransportMode
from pyVoIP.networking.transport import TransportMode
import json
import os
import pytest
Expand Down

0 comments on commit 84203ee

Please sign in to comment.