/usr/include/sipxtapi/os/OsNatSocketBaseImpl.h is in libsipxtapi-dev 3.3.0~test17-2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | // $Id$
//
// Copyright (C) 2005 Pingtel Corp.
//
// $$
//////////////////////////////////////////////////////////////////////////////
#ifndef _OsNatSocketBaseImpl_h_
#define _OsNatSocketBaseImpl_h_
// SYSTEM INCLUDES
// APPLICATION INCLUDES
#include "os/OsMutex.h"
#include "os/IStunSocket.h"
#include "os/OsNotification.h"
// The follow defines are used to keep track of what has been recorded for
// various time-based metrics.
#define ONDS_MARK_NONE 0x00000000
#define ONDS_MARK_FIRST_READ 0x00000001
#define ONDS_MARK_LAST_READ 0x00000002
#define ONDS_MARK_FIRST_WRITE 0x00000004
#define ONDS_MARK_LAST_WRITE 0x00000008
class OsNatSocketBaseImpl : public IStunSocket
{
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:
OsNatSocketBaseImpl() ;
virtual ~OsNatSocketBaseImpl() ;
/**
* Set a notification object to be signaled when the first the data
* packet is received from the socket. Once this is signaled, the
* notification object is discarded.
*/
virtual void setReadNotification(OsNotification* pNotification) ;
/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:
void markReadTime() ;
void markWriteTime() ;
/**
* Get the timestamp of the first read data packet (excluding any
* STUN/TURN/NAT packets).
*/
virtual bool getFirstReadTime(OsDateTime& time) ;
/**
* Get the timestamp of the last read data packet (excluding any
* STUN/TURN/NAT packets).
*/
virtual bool getLastReadTime(OsDateTime& time) ;
/**
* Get the timestamp of the first written data packet (excluding any
* STUN/TURN/NAT packets).
*/
virtual bool getFirstWriteTime(OsDateTime& time) ;
/**
* Get the timestamp of the last written data packet (excluding any
* STUN/TURN/NAT packets).
*/
virtual bool getLastWriteTime(OsDateTime& time) ;
/**
* Handle/process an inbound STUN message.
*/
virtual void handleStunMessage(char* pBuf, int length, UtlString& fromAddress, int fromPort) ;
/**
* Handle/process an inbound TURN message.
*/
virtual void handleTurnMessage(char* pBuf,
int length,
UtlString& fromAddress,
int fromPort) ;
/**
* Pull a data indication out of the buffer
*/
virtual int handleTurnDataIndication(char* buffer,
int bufferLength,
UtlString* pRecvFromIp,
int* pRecvFromPort) ;
/**
* Handle/process an inbound STUN or TURN message.
*/
virtual bool handleSturnData(char* buffer,
int& bufferLength,
UtlString& receivedIp,
int& receivedPort) ;
virtual OsSocket* getSocket() =0;
protected:
unsigned int miRecordTimes ; // Bitmask populated w/ ONDS_MARK_*
OsDateTime mFirstRead ;
OsDateTime mLastRead ;
OsDateTime mFirstWrite ;
OsDateTime mLastWrite ;
OsMutex mReadNotificationLock ;
OsNotification* mpReadNotification ;
};
/* ============================ INLINE METHODS ============================ */
/* ///////////////////////// HELPER CLASSES /////////////////////////////// */
#endif // _OsNatSocketBaseImpl_h_
|