| 647 | } |
| 648 | |
| 649 | void CSocks5StateMachine::process_send_command_request(bool entry) |
| 650 | { |
| 651 | if (entry) { |
| 652 | // Prepare the request command buffer |
| 653 | m_buffer[0] = SOCKS5_VERSION; |
| 654 | switch (m_proxyCommand) { |
| 655 | case PROXY_CMD_CONNECT: |
| 656 | m_buffer[1] = SOCKS5_CMD_CONNECT; |
| 657 | break; |
| 658 | |
| 659 | case PROXY_CMD_BIND: |
| 660 | m_buffer[1] = SOCKS5_CMD_BIND; |
| 661 | break; |
| 662 | |
| 663 | case PROXY_CMD_UDP_ASSOCIATE: |
| 664 | m_buffer[1] = SOCKS5_CMD_UDP_ASSOCIATE; |
| 665 | break; |
| 666 | } |
| 667 | m_buffer[2] = SOCKS5_RSV; |
| 668 | m_buffer[3] = SOCKS5_ATYP_IPV4_ADDRESS; |
| 669 | PokeUInt32( m_buffer+4, StringIPtoUint32(m_peerAddress->IPAddress()) ); |
| 670 | RawPokeUInt16( m_buffer+8, ENDIAN_HTONS( m_peerAddress->Service() ) ); |
| 671 | |
| 672 | // Send the command packet |
| 673 | m_packetLength = 10; |
| 674 | ProxyWrite(*m_proxyClientSocket, m_buffer, m_packetLength); |
| 675 | } |
| 676 | } |
| 677 | |
| 678 | void CSocks5StateMachine::process_receive_command_reply(bool entry) |
| 679 | { |
nothing calls this directly
no test coverage detected