|
Mixes for Privacy and Anonymity in the Internet
|
Public Member Functions | |
| CAMuxSocket () | |
| ~CAMuxSocket () | |
| SINT32 | getHashKey () |
| Returns a Hashkey which uniquely identifies this socket. | |
| SINT32 | accept (UINT16 port) |
| SINT32 | accept (const CASocketAddr &oAddr) |
| Waits for an incoming connection on oAddr. | |
| SINT32 | connect (CASocketAddr &psa) |
| SINT32 | connect (CASocketAddr &psa, UINT retry, UINT32 time) |
| SINT32 | close () |
| Closes the underlying socket. | |
| SINT32 | send (MIXPACKET *pPacket) |
| Sends a MixPacket over the Network. | |
| SINT32 | send (MIXPACKET *pPacket, UINT8 *buff) |
| SINT32 | prepareForSend (MIXPACKET *inoutPacket) |
| SINT32 | receive (MIXPACKET *pPacket) |
| Receives a whole MixPacket. | |
| SINT32 | receive (MIXPACKET *pPacket, UINT32 timeout) |
| Trys to receive a Mix-Packet. | |
| SINT32 | receiveFully (UINT8 *buff, UINT32 len) |
| Receives some "plain" bytes from the underlying socket - just a convenient function... | |
| SINT32 | receiveFully (UINT8 *buff, UINT32 len, UINT32 msTimeOut) |
| CASocket * | getCASocket () |
| SOCKET | getSocket () |
| SINT32 | setCrypt (bool b) |
| bool | getIsEncrypted () |
| SINT32 | setKey (UINT8 *key, UINT32 keyLen) |
| Sets the symmetric keys used for de-/encrypting the Mux connection. | |
| SINT32 | setSendKey (UINT8 *key, UINT32 keyLen) |
| SINT32 | setReceiveKey (UINT8 *key, UINT32 keyLen) |
Private Attributes | |
| CASocket | m_Socket |
| UINT32 | m_aktBuffPos |
| UINT8 * | m_Buff |
| CASymCipher | m_oCipherIn |
| CASymCipher | m_oCipherOut |
| bool | m_bIsCrypted |
| CAMutex | m_csSend |
| CAMutex | m_csReceive |
| t_hashkeylistEntry * | m_pHashKeyEntry |
Static Private Attributes | |
| static t_hashkeylistEntry * | ms_phashkeylistAvailableHashKeys = NULL |
| static SINT32 | ms_nMaxHashKeyValue = 0 |
| static CAMutex * | ms_pcsHashKeyList = new CAMutex() |
| SINT32 CAMuxSocket::accept | ( | UINT16 | port | ) |
References CASocket::accept(), CASocket::close(), CASocket::create(), E_SUCCESS, E_UNKNOWN, CASocket::listen(), m_aktBuffPos, m_Socket, and CASocket::setReuseAddr().
Referenced by CAMiddleMix::init(), and CALastMix::init().
| SINT32 CAMuxSocket::accept | ( | const CASocketAddr & | oAddr | ) |
Waits for an incoming connection on oAddr.
| E_SUCCESS,if | successful |
| E_SOCKET_BIND,E_SOCKET_LISTEN | |
| E_UNKOWN |
References CASocket::accept(), CASocket::close(), CASocket::create(), E_SUCCESS, E_UNKNOWN, CASocketAddr::getType(), CASocket::listen(), m_aktBuffPos, m_Socket, and CASocket::setReuseAddr().
Closes the underlying socket.
References CASocket::close(), m_aktBuffPos, and m_Socket.
Referenced by CALocalProxy::clean(), CAMiddleMix::clean(), CALastMix::clean(), CAFirstMix::clean(), CAFirstMixB::loop(), CALastMixB::loop(), CAMiddleMix::loop(), and ~CAMuxSocket().
| SINT32 CAMuxSocket::connect | ( | CASocketAddr & | psa | ) |
Referenced by CAMiddleMix::connectToNextMix(), CAFirstMix::connectToNextMix(), and CALocalProxy::init().
| SINT32 CAMuxSocket::connect | ( | CASocketAddr & | psa, |
| UINT | retry, | ||
| UINT32 | time | ||
| ) |
References CASocket::connect(), m_aktBuffPos, and m_Socket.
References m_Socket.
Referenced by CAFirstMixChannelList::add(), CAFirstMix::doUserLogin_internal(), fm_loopAcceptUsers(), CALocalProxy::init(), CAMiddleMix::init(), CALastMix::init(), CAFirstMix::init(), CAFirstMixB::loop(), CALocalProxy::processKeyExchange(), CAMiddleMix::processKeyExchange(), CALastMix::processKeyExchange(), CAFirstMix::processKeyExchange(), CAFirstMixA::sendToUsers(), and CAFirstMixChannelList::test().
Returns a Hashkey which uniquely identifies this socket.
References __t_hash_key_entry__::hashkey, and m_pHashKeyEntry.
Referenced by CAFirstMixChannelList::add(), CAFirstMixChannelList::addChannel(), CAFirstMixChannelList::get(), CAFirstMixChannelList::getFirstChannelForSocket(), CAFirstMixChannelList::remove(), and CAFirstMixChannelList::removeChannel().
| bool CAMuxSocket::getIsEncrypted | ( | ) |
References m_bIsCrypted.
References CASocket::getSocket(), and m_Socket.
Referenced by CASocketGroupEpoll::add(), CASocketGroup::add(), CASocketGroup::isSignaled(), CAFirstMixB::loop(), and CASocketGroup::remove().
| SINT32 CAMuxSocket::prepareForSend | ( | MIXPACKET * | inoutPacket | ) |
References t_MixPacket::channel, CASymCipher::crypt1(), t_MixPacket::flags, CAMutex::lock(), m_csSend, m_oCipherOut, MIXPACKET_SIZE, and CAMutex::unlock().
Referenced by CAFirstMix::doUserLogin_internal(), CAFirstMixB::loop(), and CAFirstMixA::sendToUsers().
| SINT32 CAMuxSocket::receive | ( | MIXPACKET * | pPacket | ) |
Receives a whole MixPacket.
Blocks until a packet is received or a socket error occurs.
| pPacket | on return stores the received MixPacket |
| SOCKET_ERROR,in | case of an error |
| MIXPACKET_SIZE | otherwise |
References CASymCipher::crypt1(), E_SUCCESS, E_UNKNOWN, CAMutex::lock(), m_bIsCrypted, m_csReceive, m_oCipherIn, m_Socket, MIXPACKET_SIZE, CAMsg::printMsg(), CAClientSocket::receiveFully(), SOCKET_ERROR, and CAMutex::unlock().
Referenced by CAFirstMix::doUserLogin_internal(), fm_loopReadFromMix(), lm_loopReadFromMix(), CAFirstMixB::loop(), CAFirstMixA::loop(), CALocalProxy::loop(), mm_loopReadFromMixAfter(), and mm_loopReadFromMixBefore().
| SINT32 CAMuxSocket::receive | ( | MIXPACKET * | pPacket, |
| UINT32 | msTimeout | ||
| ) |
Trys to receive a Mix-Packet.
If after timout milliseconds not a whole packet is available E_AGAIN will be returned. In this case you should later try to get the rest of the packet
References CASocketGroup::add(), add64(), t_MixPacket::channel, CASymCipher::crypt1(), diff64(), E_AGAIN, E_NOT_CONNECTED, E_SUCCESS, E_UNKNOWN, t_MixPacket::flags, GET_NET_ERROR, GET_NET_ERROR_STR, getcurrentTimeMillis(), CASocket::isClosed(), isEqual64(), isGreater64(), len, CAMutex::lock(), m_aktBuffPos, m_bIsCrypted, m_Buff, m_csReceive, m_oCipherIn, m_Socket, MIXPACKET_SIZE, CAMsg::printMsg(), CASocket::receive(), CASocketGroup::select(), and CAMutex::unlock().
| SINT32 CAMuxSocket::receiveFully | ( | UINT8 * | buff, |
| UINT32 | len | ||
| ) |
Receives some "plain" bytes from the underlying socket - just a convenient function...
References m_Socket, and CAClientSocket::receiveFully().
Referenced by CAMiddleMix::processKeyExchange(), CALastMix::processKeyExchange(), and CAFirstMix::processKeyExchange().
| SINT32 CAMuxSocket::receiveFully | ( | UINT8 * | buff, |
| UINT32 | len, | ||
| UINT32 | msTimeOut | ||
| ) |
References m_Socket, and CASocket::receiveFullyT().
| SINT32 CAMuxSocket::send | ( | MIXPACKET * | pPacket | ) |
Sends a MixPacket over the Network.
Will block until the whole packet is send.
| pPacket | MixPacket to send |
| MIXPACKET_SIZE | if MixPacket was successful send |
| E_UNKNOWN | otherwise |
References t_MixPacket::channel, CASymCipher::crypt1(), E_SUCCESS, E_UNKNOWN, t_MixPacket::flags, GET_NET_ERROR, CAMutex::lock(), m_bIsCrypted, m_csSend, m_oCipherOut, m_Socket, MIXPACKET_SIZE, CAMsg::printMsg(), CASocket::sendFully(), and CAMutex::unlock().
Referenced by fm_loopSendToMix(), lm_loopSendToMix(), CALocalProxy::loop(), mm_loopReadFromMixAfter(), mm_loopReadFromMixBefore(), mm_loopSendToMixAfter(), mm_loopSendToMixBefore(), and CALocalProxy::processKeyExchange().
| SINT32 CAMuxSocket::send | ( | MIXPACKET * | pPacket, |
| UINT8 * | buff | ||
| ) |
| SINT32 CAMuxSocket::setCrypt | ( | bool | b | ) |
| SINT32 CAMuxSocket::setKey | ( | UINT8 * | key, |
| UINT32 | keyLen | ||
| ) |
Sets the symmetric keys used for de-/encrypting the Mux connection.
| key | buffer conntaining the key bits |
| keyLen | size of the buffer (keys) if keylen=16, then the key is used for incomming and outgoing direction (key only) if keylen=32, then the first bytes are used for incoming and the last bytes are used for outgoing |
| E_SUCCESS | if successful |
| E_UNKNOWN | otherwise |
References E_SUCCESS, E_UNKNOWN, m_oCipherIn, m_oCipherOut, and CASymCipher::setKey().
| SINT32 CAMuxSocket::setReceiveKey | ( | UINT8 * | key, |
| UINT32 | keyLen | ||
| ) |
| SINT32 CAMuxSocket::setSendKey | ( | UINT8 * | key, |
| UINT32 | keyLen | ||
| ) |
UINT32 CAMuxSocket::m_aktBuffPos [private] |
Referenced by accept(), CAMuxSocket(), close(), connect(), and receive().
bool CAMuxSocket::m_bIsCrypted [private] |
Referenced by CAMuxSocket(), getIsEncrypted(), receive(), send(), and setCrypt().
UINT8* CAMuxSocket::m_Buff [private] |
Referenced by CAMuxSocket(), receive(), and ~CAMuxSocket().
CAMutex CAMuxSocket::m_csReceive [private] |
Referenced by receive(), and setCrypt().
CAMutex CAMuxSocket::m_csSend [private] |
Referenced by prepareForSend(), send(), and setCrypt().
CASymCipher CAMuxSocket::m_oCipherIn [private] |
Referenced by receive(), setKey(), and setReceiveKey().
CASymCipher CAMuxSocket::m_oCipherOut [private] |
Referenced by prepareForSend(), send(), setKey(), and setSendKey().
t_hashkeylistEntry* CAMuxSocket::m_pHashKeyEntry [private] |
Referenced by CAMuxSocket(), getHashKey(), and ~CAMuxSocket().
CASocket CAMuxSocket::m_Socket [private] |
Referenced by accept(), close(), connect(), getCASocket(), getSocket(), receive(), receiveFully(), and send().
SINT32 CAMuxSocket::ms_nMaxHashKeyValue = 0 [static, private] |
Referenced by CAMuxSocket().
CAMutex * CAMuxSocket::ms_pcsHashKeyList = new CAMutex() [static, private] |
Referenced by CAMuxSocket(), and ~CAMuxSocket().
t_hashkeylistEntry * CAMuxSocket::ms_phashkeylistAvailableHashKeys = NULL [static, private] |
Referenced by CAMuxSocket(), and ~CAMuxSocket().
1.7.6.1