Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
2.3 KiB

  1. #ifndef __RSIP_H_
  2. #define __RSIP_H_
  3. #include "rsipdefs.h" // make certain this is defined first!
  4. // globals here
  5. extern CRITICAL_SECTION g_CritSec;
  6. extern SOCKET g_sRsip;
  7. extern SOCKADDR_IN g_saddrGateway;
  8. extern SOCKADDR g_saddrPublic;
  9. extern int g_iPort;
  10. extern DWORD g_ClientID;
  11. extern HANDLE g_hThreadEvent;
  12. extern HANDLE g_hAlertEvent;
  13. extern RSIP_LEASE_RECORD *g_pRsipLeaseRecords; // list of leases.
  14. extern ADDR_ENTRY *g_pAddrEntry; // cache of mappings.
  15. extern DWORD g_tuRetry; // microseconds starting retry time.
  16. extern LONG g_MsgID;
  17. /*
  18. * Here is all the RSIP code we swiped from the DirectPlay guys
  19. */
  20. BOOL Initialize( SOCKADDR *pBaseSocketAddress,
  21. BOOL fIsRsipServer );
  22. void Deinitialize( void );
  23. BOOL RsipIsRunningOnThisMachine( SOCKADDR *pPublicSocketAddress );
  24. HRESULT AssignPort( BOOL fTCP_UDP,
  25. WORD wPort,
  26. SOCKADDR *pSocketAddress,
  27. DWORD *pdwBindID ); // gets address on RSIP box
  28. HRESULT FreePort( DWORD dwBindID ); // when port is done
  29. HRESULT QueryLocalAddress( BOOL fTCP_UDP,
  30. SOCKADDR *pQueryAddress,
  31. SOCKADDR *pLocalAddress) ; // called to map remote to local
  32. HRESULT ListenPort( BOOL fTCP_UDP,
  33. WORD wPort,
  34. SOCKADDR *pListenAddress,
  35. DWORD *pBindID ); // called for ROD
  36. HRESULT FindGateway( UINT myip, char *gwipaddr);
  37. HRESULT Register( void );
  38. HRESULT Deregister( void );
  39. DWORD ExchangeAndParse( PCHAR pRequest,
  40. UINT cbReq,
  41. RSIP_RESPONSE_INFO *pRespInfo,
  42. DWORD messageid,
  43. BOOL bConnect,
  44. SOCKADDR *pRecvSocketAddress );
  45. HRESULT Parse( CHAR *pBuf, DWORD cbBuf, RSIP_RESPONSE_INFO *pRespInfo );
  46. HRESULT ExtendPort( DWORD Bindid, DWORD *ptExtend );
  47. void RemoveLease( DWORD dwBindID );
  48. void AddLease( DWORD dwBindID, BOOL fTCP_UDP, DWORD addrV4, WORD lport, WORD port, DWORD tLease);
  49. RSIP_LEASE_RECORD *FindLease( BOOL fTCP_UDP, WORD port );
  50. void AddCacheEntry( BOOL fTCP_UDP, DWORD addr, WORD port, DWORD raddr, WORD rport);
  51. ADDR_ENTRY *FindCacheEntry( BOOL fTCP_UDP, DWORD addr, WORD port);
  52. void RsipTimerComplete( HRESULT hCompletionCode, void *pContext );
  53. void RsipTimerFunction( void *pContext );
  54. BOOL PortExtend( DWORD dwTime ); // every 2 minutes
  55. void CacheClear( DWORD dwTime ); // every 2 minutes
  56. #endif // __RSIP_H_