Changeset 198
- Timestamp:
- 12/04/07 17:46:47
(9 months ago)
- Author:
- sip
- Message:
Added LogicalChannelRate? and ModeRequest?.
Implemented new logging feature.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r196 |
r198 |
|
| 20 | 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|---|
| 21 | 21 | */ |
|---|
| | 22 | #include <stdarg.h> |
|---|
| | 23 | #include <stdio.h> |
|---|
| | 24 | #include <string.h> |
|---|
| | 25 | #include <sys/types.h> |
|---|
| | 26 | #include <sys/stat.h> |
|---|
| | 27 | #include <fcntl.h> |
|---|
| | 28 | #include <unistd.h> |
|---|
| 22 | 29 | #include "FileLogger.h" |
|---|
| 23 | | #include <stdarg.h> |
|---|
| 24 | 30 | |
|---|
| 25 | 31 | FileLogger::FileLogger() |
|---|
| … | … | |
| 35 | 41 | } |
|---|
| 36 | 42 | |
|---|
| 37 | | #ifdef DUMP_H223 |
|---|
| 38 | 43 | void FileLogger::SetMuxByte(BYTE b) |
|---|
| 39 | 44 | { |
|---|
| 40 | | //New line |
|---|
| 41 | | if (num % 32 == 0) |
|---|
| 42 | | { |
|---|
| 43 | | if (num>0) |
|---|
| 44 | | { |
|---|
| 45 | | char name[256]; |
|---|
| 46 | | sprintf(name,"/tmp/h245_out_%x.log",(unsigned int)this); |
|---|
| 47 | | int fd = open(name,O_CREAT|O_WRONLY|O_APPEND); |
|---|
| 48 | | write(fd,line1,linesize); |
|---|
| 49 | | write(fd,"\r\n",2); |
|---|
| 50 | | write(fd,line3,linesize); |
|---|
| 51 | | write(fd,"\r\n",2); |
|---|
| | 45 | if (level>5) |
|---|
| | 46 | { |
|---|
| | 47 | //New line |
|---|
| | 48 | if (num % 32 == 0) |
|---|
| | 49 | { |
|---|
| | 50 | if (num>0) |
|---|
| | 51 | { |
|---|
| | 52 | char name[256]; |
|---|
| | 53 | sprintf(name,"/tmp/h245_out_%x.log",(unsigned int)this); |
|---|
| | 54 | int fd = open(name,O_CREAT|O_WRONLY|O_APPEND); |
|---|
| | 55 | if (fd!=-1) |
|---|
| | 56 | { |
|---|
| | 57 | write(fd,line1,linesize); |
|---|
| | 58 | write(fd,"\r\n",2); |
|---|
| | 59 | write(fd,line3,linesize); |
|---|
| | 60 | write(fd,"\r\n",2); |
|---|
| | 61 | close(fd); |
|---|
| | 62 | } |
|---|
| | 63 | } |
|---|
| | 64 | sprintf(line1,"%.8X ",num); |
|---|
| | 65 | l1 = line1+8; |
|---|
| | 66 | } |
|---|
| | 67 | |
|---|
| | 68 | int numchar = sprintf(l1," %.2X",b); |
|---|
| | 69 | l1[numchar] = ' '; |
|---|
| | 70 | l1+=3; |
|---|
| | 71 | num++; |
|---|
| | 72 | } |
|---|
| | 73 | } |
|---|
| | 74 | |
|---|
| | 75 | void FileLogger::SetMuxInfo(const char*info,...) |
|---|
| | 76 | { |
|---|
| | 77 | if (level>5) |
|---|
| | 78 | { |
|---|
| | 79 | va_list ap; |
|---|
| | 80 | |
|---|
| | 81 | //Set list |
|---|
| | 82 | va_start(ap,info); |
|---|
| | 83 | |
|---|
| | 84 | //Set line info |
|---|
| | 85 | int numchar = vsprintf(l2,info,ap); |
|---|
| | 86 | |
|---|
| | 87 | //Reset list |
|---|
| | 88 | va_end(ap); |
|---|
| | 89 | |
|---|
| | 90 | //Remove \0 |
|---|
| | 91 | l2[numchar]=' '; |
|---|
| | 92 | |
|---|
| | 93 | //Move l2 |
|---|
| | 94 | l2 += numchar; |
|---|
| | 95 | |
|---|
| | 96 | //Calculate the remining |
|---|
| | 97 | int rest = l2-line2-32*3; |
|---|
| | 98 | |
|---|
| | 99 | //if we have past the end of line |
|---|
| | 100 | if (rest>=0) |
|---|
| | 101 | { |
|---|
| | 102 | //Set to blank |
|---|
| | 103 | memset(line3,' ',linesize); |
|---|
| | 104 | //Copy to line3 |
|---|
| | 105 | memcpy(line3+8,line2,32*3); |
|---|
| | 106 | //Move end of line2 to begining |
|---|
| | 107 | memcpy(line2,line2+32*3,rest); |
|---|
| | 108 | //Move to the begining |
|---|
| | 109 | l2 = line2+rest; |
|---|
| | 110 | } |
|---|
| | 111 | } |
|---|
| | 112 | } |
|---|
| | 113 | |
|---|
| | 114 | void FileLogger::SetDemuxByte(BYTE b) |
|---|
| | 115 | { |
|---|
| | 116 | if (level>5) |
|---|
| | 117 | { |
|---|
| | 118 | //New line |
|---|
| | 119 | if (num % 32 == 0) |
|---|
| | 120 | { |
|---|
| | 121 | if (num>0) |
|---|
| | 122 | { |
|---|
| | 123 | char name[256]; |
|---|
| | 124 | sprintf(name,"/tmp/h245_%x.log",(unsigned int)this); |
|---|
| | 125 | int fd = open(name,O_CREAT|O_WRONLY|O_APPEND); |
|---|
| | 126 | if (fd!=-1) |
|---|
| | 127 | { |
|---|
| | 128 | write(fd,line3,linesize-6); |
|---|
| | 129 | if (line3[linesize-5]==' ') { |
|---|
| | 130 | write(fd,line2+2,6); |
|---|
| | 131 | } else if (line3[linesize-3]!=' ') { |
|---|
| | 132 | write(fd,line3+linesize-6,3); |
|---|
| | 133 | write(fd,line2+5,3); |
|---|
| | 134 | } else { |
|---|
| | 135 | write(fd,line3+linesize-6,6); |
|---|
| | 136 | } |
|---|
| | 137 | memset(line2,' ',8); |
|---|
| | 138 | write(fd,"\r\n",2); |
|---|
| | 139 | write(fd,line1,linesize); |
|---|
| | 140 | write(fd,"\r\n",2); |
|---|
| | 141 | memcpy(line3,line2,linesize); |
|---|
| | 142 | } |
|---|
| | 143 | close(fd); |
|---|
| | 144 | } else |
|---|
| | 145 | memset(line3,' ',linesize); |
|---|
| | 146 | sprintf(line1,"%.8X ",num); |
|---|
| | 147 | memset(line2,' ',linesize); |
|---|
| | 148 | l1 = line1+8; |
|---|
| | 149 | l2 = line2+8; |
|---|
| | 150 | |
|---|
| | 151 | } |
|---|
| | 152 | int numchar = sprintf(l1," %.2X",b); |
|---|
| | 153 | l1[numchar] = ' '; |
|---|
| | 154 | numchar = sprintf(l2," "); |
|---|
| | 155 | l2[numchar] = ' '; |
|---|
| | 156 | l1+=3; |
|---|
| | 157 | l2+=3; |
|---|
| | 158 | num++; |
|---|
| | 159 | } |
|---|
| | 160 | } |
|---|
| | 161 | |
|---|
| | 162 | void FileLogger::SetDemuxInfo(int offset,const char*info,...) |
|---|
| | 163 | { |
|---|
| | 164 | if (level>5) |
|---|
| | 165 | { |
|---|
| | 166 | va_list ap; |
|---|
| | 167 | |
|---|
| | 168 | //Set list |
|---|
| | 169 | va_start(ap,info); |
|---|
| | 170 | |
|---|
| | 171 | //Set line info |
|---|
| | 172 | int numchar = vsprintf(l2+offset,info,ap); |
|---|
| | 173 | |
|---|
| | 174 | //Reset list |
|---|
| | 175 | va_end(ap); |
|---|
| | 176 | |
|---|
| | 177 | //Remove \0 |
|---|
| | 178 | l2[numchar+offset]=' '; |
|---|
| | 179 | } |
|---|
| | 180 | } |
|---|
| | 181 | |
|---|
| | 182 | void FileLogger::DumpMedia(BYTE *data,DWORD len) |
|---|
| | 183 | { |
|---|
| | 184 | if (level>5) |
|---|
| | 185 | { |
|---|
| | 186 | char name[256]; |
|---|
| | 187 | sprintf(name,"/tmp/media_%x.raw",(unsigned int)this); |
|---|
| | 188 | int fd = open(name,O_CREAT|O_WRONLY|O_APPEND); |
|---|
| | 189 | if (fd!=-1) |
|---|
| | 190 | { |
|---|
| | 191 | write(fd,data,len); |
|---|
| 52 | 192 | close(fd); |
|---|
| 53 | | } |
|---|
| 54 | | sprintf(line1,"%.8X ",num); |
|---|
| 55 | | l1 = line1+8; |
|---|
| 56 | | } |
|---|
| 57 | | |
|---|
| 58 | | int numchar = sprintf(l1," %.2X",b); |
|---|
| 59 | | l1[numchar] = ' '; |
|---|
| 60 | | l1+=3; |
|---|
| 61 | | num++; |
|---|
| 62 | | } |
|---|
| 63 | | |
|---|
| 64 | | void FileLogger::SetMuxInfo(const char*info,...) |
|---|
| 65 | | { |
|---|
| 66 | | va_list ap; |
|---|
| 67 | | |
|---|
| 68 | | //Set list |
|---|
| 69 | | va_start(ap,info); |
|---|
| 70 | | |
|---|
| 71 | | //Set line info |
|---|
| 72 | | int numchar = vsprintf(l2,info,ap); |
|---|
| 73 | | |
|---|
| 74 | | //Remove \0 |
|---|
| 75 | | l2[numchar]=' '; |
|---|
| 76 | | |
|---|
| 77 | | //Move l2 |
|---|
| 78 | | l2 += numchar; |
|---|
| 79 | | |
|---|
| 80 | | //Calculate the remining |
|---|
| 81 | | int rest = l2-line2-32*3; |
|---|
| 82 | | |
|---|
| 83 | | //if we have past the end of line |
|---|
| 84 | | if (rest>=0) |
|---|
| 85 | | { |
|---|
| 86 | | //Set to blank |
|---|
| 87 | | memset(line3,' ',linesize); |
|---|
| 88 | | //Copy to line3 |
|---|
| 89 | | memcpy(line3+8,line2,32*3); |
|---|
| 90 | | //Move end of line2 to begining |
|---|
| 91 | | memcpy(line2,line2+32*3,rest); |
|---|
| 92 | | //Move to the begining |
|---|
| 93 | | l2 = line2+rest; |
|---|
| 94 | | } |
|---|
| 95 | | } |
|---|
| 96 | | |
|---|
| 97 | | void FileLogger::SetDemuxByte(BYTE b) |
|---|
| 98 | | { |
|---|
| 99 | | //New line |
|---|
| 100 | | if (num % 32 == 0) |
|---|
| 101 | | { |
|---|
| 102 | | if (num>0) |
|---|
| 103 | | { |
|---|
| 104 | | char name[256]; |
|---|
| 105 | | sprintf(name,"/tmp/h245_%x.log",(unsigned int)this); |
|---|
| 106 | | int fd = open(name,O_CREAT|O_WRONLY|O_APPEND); |
|---|
| 107 | | write(fd,line3,linesize-6); |
|---|
| 108 | | if (line3[linesize-5]==' ') { |
|---|
| 109 | | write(fd,line2+2,6); |
|---|
| 110 | | } else if (line3[linesize-3]!=' ') { |
|---|
| 111 | | write(fd,line3+linesize-6,3); |
|---|
| 112 | | write(fd,line2+5,3); |
|---|
| 113 | | } else { |
|---|
| 114 | | write(fd,line3+linesize-6,6); |
|---|
| 115 | | } |
|---|
| 116 | | memset(line2,' ',8); |
|---|
| 117 | | write(fd,"\r\n",2); |
|---|
| 118 | | write(fd,line1,linesize); |
|---|
| 119 | | write(fd,"\r\n",2); |
|---|
| 120 | | memcpy(line3,line2,linesize); |
|---|
| | 193 | } |
|---|
| | 194 | } |
|---|
| | 195 | } |
|---|
| | 196 | |
|---|
| | 197 | void FileLogger::DumpInput(BYTE *data,DWORD len) |
|---|
| | 198 | { |
|---|
| | 199 | if (level>5) |
|---|
| | 200 | { |
|---|
| | 201 | char name[256]; |
|---|
| | 202 | sprintf(name,"/tmp/h223_in_%x.raw",(unsigned int)this); |
|---|
| | 203 | int fd = open(name,O_CREAT|O_WRONLY|O_APPEND); |
|---|
| | 204 | if (fd!=-1) |
|---|
| | 205 | { |
|---|
| | 206 | write(fd,data,len); |
|---|
| 121 | 207 | close(fd); |
|---|
| 122 | | } else |
|---|
| 123 | | memset(line3,' ',linesize); |
|---|
| 124 | | sprintf(line1,"%.8X ",num); |
|---|
| 125 | | memset(line2,' ',linesize); |
|---|
| 126 | | l1 = line1+8; |
|---|
| 127 | | l2 = line2+8; |
|---|
| 128 | | |
|---|
| 129 | | } |
|---|
| 130 | | int numchar = sprintf(l1," %.2X",b); |
|---|
| 131 | | l1[numchar] = ' '; |
|---|
| 132 | | numchar = sprintf(l2," "); |
|---|
| 133 | | l2[numchar] = ' '; |
|---|
| 134 | | l1+=3; |
|---|
| 135 | | l2+=3; |
|---|
| 136 | | num++; |
|---|
| 137 | | } |
|---|
| 138 | | |
|---|
| 139 | | void FileLogger::SetDemuxInfo(int offset,const char*info,...) |
|---|
| 140 | | { |
|---|
| 141 | | va_list ap; |
|---|
| 142 | | |
|---|
| 143 | | //Set list |
|---|
| 144 | | va_start(ap,info); |
|---|
| 145 | | |
|---|
| 146 | | //Set line info |
|---|
| 147 | | int numchar = vsprintf(l2+offset,info,ap); |
|---|
| 148 | | |
|---|
| 149 | | //Remove \0 |
|---|
| 150 | | l2[numchar+offset]=' '; |
|---|
| 151 | | } |
|---|
| 152 | | #else |
|---|
| 153 | | |
|---|
| 154 | | void FileLogger::SetMuxByte(BYTE b) |
|---|
| 155 | | { |
|---|
| 156 | | } |
|---|
| 157 | | |
|---|
| 158 | | void FileLogger::SetMuxInfo(const char*info,...) |
|---|
| 159 | | { |
|---|
| 160 | | } |
|---|
| 161 | | |
|---|
| 162 | | void FileLogger::SetDemuxByte(BYTE b) |
|---|
| 163 | | { |
|---|
| 164 | | } |
|---|
| 165 | | |
|---|
| 166 | | void FileLogger::SetDemuxInfo(int offset,const char*info,...) |
|---|
| 167 | | { |
|---|
| 168 | | } |
|---|
| 169 | | #endif |
|---|
| | 208 | } |
|---|
| | 209 | } |
|---|
| | 210 | } |
|---|
| | 211 | |
|---|
| | 212 | void FileLogger::DumpOutput(BYTE *data,DWORD len) |
|---|
| | 213 | { |
|---|
| | 214 | if (level>5) |
|---|
| | 215 | { |
|---|
| | 216 | char name[256]; |
|---|
| | 217 | sprintf(name,"/tmp/h223_out_%x.raw",(unsigned int)this); |
|---|
| | 218 | int fd = open(name,O_CREAT|O_WRONLY|O_APPEND); |
|---|
| | 219 | if (fd!=-1) |
|---|
| | 220 | { |
|---|
| | 221 | write(fd,data,len); |
|---|
| | 222 | close(fd); |
|---|
| | 223 | } |
|---|
| | 224 | } |
|---|
| | 225 | } |
|---|
| r196 |
r198 |
|
| 18 | 18 | virtual void SetDemuxByte(BYTE b); |
|---|
| 19 | 19 | virtual void SetDemuxInfo(int offset,const char*info,...); |
|---|
| | 20 | virtual void DumpMedia(BYTE *data,DWORD len); |
|---|
| | 21 | virtual void DumpInput(BYTE *data,DWORD len); |
|---|
| | 22 | virtual void DumpOutput(BYTE *data,DWORD len); |
|---|
| 20 | 23 | private: |
|---|
| 21 | 24 | char line1[linesize]; |
|---|
| r66 |
r198 |
|
| 2 | 2 | #define _H223AL_H_ |
|---|
| 3 | 3 | |
|---|
| 4 | | #include "H223Const.h" |
|---|
| | 4 | #include "H324MConfig.h" |
|---|
| 5 | 5 | #include "H223MuxSDU.h" |
|---|
| 6 | 6 | |
|---|
| … | … | |
| 12 | 12 | virtual void SendClosingFlag()=0; |
|---|
| 13 | 13 | virtual int IsSegmentable() = 0; |
|---|
| | 14 | virtual ~H223ALReceiver() = 0; |
|---|
| 14 | 15 | }; |
|---|
| 15 | 16 | |
|---|
| … | … | |
| 21 | 22 | virtual void OnPDUCompleted()=0; |
|---|
| 22 | 23 | virtual int IsSegmentable() = 0; |
|---|
| | 24 | virtual ~H223ALSender() = 0; |
|---|
| 23 | 25 | }; |
|---|
| 24 | 26 | |
|---|
| … | … | |
| 28 | 30 | //H223SDUListener |
|---|
| 29 | 31 | virtual void OnSDU(BYTE* data,DWORD length) = 0; |
|---|
| | 32 | virtual ~H223SDUListener() = 0; |
|---|
| 30 | 33 | }; |
|---|
| 31 | 34 | #endif |
|---|
| r99 |
r198 |
|
| 2 | 2 | #define _H223Demuxer_H_ |
|---|
| 3 | 3 | |
|---|
| 4 | | #include "H223Const.h" |
|---|
| | 4 | #include "H324MConfig.h" |
|---|
| 5 | 5 | #include "H223AL.h" |
|---|
| 6 | 6 | #include "H223MuxTable.h" |
|---|
| r3 |
r198 |
|
| 1 | 1 | #ifndef _H223FLAG_H_ |
|---|
| 2 | 2 | #define _H223FLAG_H_ |
|---|
| 3 | | #include "H223Const.h" |
|---|
| | 3 | #include "H324MConfig.h" |
|---|
| 4 | 4 | |
|---|
| 5 | 5 | class H223Flag |
|---|
| r3 |
r198 |
|
| 1 | 1 | #ifndef _H223HEADER_H_ |
|---|
| 2 | 2 | #define _H223HEADER_H_ |
|---|
| 3 | | #include "H223Const.h" |
|---|
| | 3 | #include "H324MConfig.h" |
|---|
| 4 | 4 | |
|---|
| 5 | 5 | class H223Header |
|---|
| r63 |
r198 |
|
| 2 | 2 | #define _H223MUXSDU_H_ |
|---|
| 3 | 3 | |
|---|
| 4 | | #include "H223Const.h" |
|---|
| | 4 | #include "H324MConfig.h" |
|---|
| 5 | 5 | |
|---|
| 6 | 6 | #include <list> |
|---|
| 7 | 7 | #include <map> |
|---|
| 8 | | using namespace std; |
|---|
| 9 | 8 | |
|---|
| 10 | 9 | class H223MuxSDU |
|---|
| … | … | |
| 15 | 14 | ~H223MuxSDU(); |
|---|
| 16 | 15 | |
|---|
| 17 | | int Push(BYTE b); |
|---|
| | 16 | int Push(BYTE b); |
|---|
| 18 | 17 | int Push(BYTE *b,int len); |
|---|
| 19 | 18 | BYTE Pop(); |
|---|
| 20 | 19 | BYTE *GetPointer() {return buffer;} |
|---|
| 21 | | int Length(); |
|---|
| | 20 | int Length(); |
|---|
| 22 | 21 | |
|---|
| 23 | 22 | void Begin(); |
|---|
| … | … | |
| 31 | 30 | }; |
|---|
| 32 | 31 | |
|---|
| 33 | | typedef map<int,H223MuxSDU*> H223MuxSDUMap; |
|---|
| 34 | | typedef list<H223MuxSDU*> H223MuxSDUList; |
|---|
| | 32 | typedef std::map<int,H223MuxSDU*> H223MuxSDUMap; |
|---|
| | 33 | typedef std::list<H223MuxSDU*> H223MuxSDUList; |
|---|
| 35 | 34 | |
|---|
| 36 | 35 | #endif |
|---|
| r26 |
r198 |
|
| 1 | 1 | #ifndef _H223MUXTABLE_H_ |
|---|
| 2 | 2 | #define _H223MUXTABLE_H_ |
|---|
| 3 | | #include "H223Const.h" |
|---|
| 4 | 3 | #include "H245.h" |
|---|
| 5 | 4 | |
|---|
| r196 |
r198 |
|
| 22 | 22 | #include "H223Muxer.h" |
|---|
| 23 | 23 | #include "FileLogger.h" |
|---|
| | 24 | |
|---|
| 24 | 25 | extern "C" |
|---|
| 25 | 26 | { |
|---|
| 26 | 27 | #include "golay.h" |
|---|
| 27 | 28 | } |
|---|
| 28 | | |
|---|
| 29 | | #define Debug printf |
|---|
| 30 | 29 | |
|---|
| 31 | 30 | H223Muxer::H223Muxer() |
|---|
| r99 |
r198 |
|
| 2 | 2 | #define _H223MUXER_H_ |
|---|
| 3 | 3 | |
|---|
| 4 | | #include "H223Const.h" |
|---|
| | 4 | #include "H324MConfig.h" |
|---|
| 5 | 5 | #include "H223MuxTable.h" |
|---|
| 6 | 6 | #include "H223MuxSDU.h" |
|---|
| r196 |
r198 |
|
| 210 | 210 | int H245ChannelsFactory::OnEstablishIndication(int number, H245Channel *channel) |
|---|
| 211 | 211 | { |
|---|
| 212 | | Debug("-OnEstablishIndication [%d]\n",number); |
|---|
| | 212 | Logger::Debug("-OnEstablishIndication [%d]\n",number); |
|---|
| 213 | 213 | |
|---|
| 214 | 214 | int local = -1; |
|---|
| … | … | |
| 256 | 256 | int H245ChannelsFactory::OnEstablishConfirm(int number) |
|---|
| 257 | 257 | { |
|---|
| 258 | | Debug("-OnEstablishConfirm [%d]\n",number); |
|---|
| | 258 | Logger::Debug("-OnEstablishConfirm [%d]\n",number); |
|---|
| 259 | 259 | |
|---|
| 260 | 260 | //Search channel |
|---|
| r196 |
r198 |
|
| 17 | 17 | virtual int OnChannelStablished(int channel, MediaType type) = 0; |
|---|
| 18 | 18 | virtual int OnChannelReleased(int channel, MediaType type) = 0; |
|---|
| | 19 | virtual ~H245ChannelsFactoryListener() = 0; |
|---|
| 19 | 20 | }; |
|---|
| 20 | 21 | |
|---|
| r7 |
r198 |
|
| 14 | 14 | e_ModeRequest, |
|---|
| 15 | 15 | e_RoundTripDelay, |
|---|
| 16 | | e_MultiplexTable |
|---|
| | 16 | e_MultiplexTable, |
|---|
| | 17 | e_LogicalChannelRate |
|---|
| 17 | 18 | }; |
|---|
| 18 | 19 | |
|---|
| … | … | |
| 32 | 33 | virtual int OnH245Indication(H245_IndicationMessage& ind) = 0; |
|---|
| 33 | 34 | */ |
|---|
| | 35 | virtual ~H245Connection() = 0; |
|---|
| 34 | 36 | }; |
|---|
| 35 | 37 | |
|---|
| r196 |
r198 |
|
| 20 | 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|---|
| 21 | 21 | */ |
|---|
| 22 | | |
|---|
| 23 | 22 | #include "H245LogicalChannels.h" |
|---|
| 24 | | |
|---|
| 25 | | #define Debug printf |
|---|
| | 23 | #include "log.h" |
|---|
| 26 | 24 | |
|---|
| 27 | 25 | H245LogicalChannels::H245LogicalChannels(H245Connection & con) |
|---|
| … | … | |
| 38 | 36 | int H245LogicalChannels::EstablishRequest(int channelNumber,H245Channel & channel) |
|---|
| 39 | 37 | { |
|---|
| 40 | | Debug("H245 H245LogicalChannels Establish Request [%d]\n", channelNumber); |
|---|
| | 38 | Logger::Debug("H245 H245LogicalChannels Establish Request [%d]\n", channelNumber); |
|---|
| 41 | 39 | |
|---|
| 42 | 40 | //TODO: Store h245channel on list |
|---|
| … | … | |
| 93 | 91 | int H245LogicalChannels::ReleaseRequest(int channelNumber) |
|---|
| 94 | 92 | { |
|---|
| 95 | | Debug("H245 H245LogicalChannels Release Request [%d]\n", channelNumber); |
|---|
| | 93 | Logger::Debug("H245 H245LogicalChannels Release Request [%d]\n", channelNumber); |
|---|
| 96 | 94 | |
|---|
| 97 | 95 | //Pdu |
|---|
| … | … | |
| 143 | 141 | int channelNumber = pdu.m_forwardLogicalChannelNumber; |
|---|
| 144 | 142 | |
|---|
| 145 | | Debug("H245 H245LogicalChannelAck received [%d]\n", channelNumber); |
|---|
| | 143 | Logger::Debug("H245 H245LogicalChannelAck received [%d]\n", channelNumber); |
|---|
| 146 | 144 | |
|---|
| 147 | 145 | //See if channel exist |
|---|
| … | … | |
| 178 | 176 | int channelNumber = pdu.m_forwardLogicalChannelNumber; |
|---|
| 179 | 177 | |
|---|
| 180 | | Debug("H245 H245LogicalChannelReject received [%d]\n", channelNumber); |
|---|
| | 178 | Logger::Debug("H245 H245LogicalChannelReject received [%d]\n", channelNumber); |
|---|
| 181 | 179 | |
|---|
| 182 | 180 | //See if channel exist |
|---|
| … | … | |
| 219 | 217 | int channelNumber = pdu.m_forwardLogicalChannelNumber; |
|---|
| 220 | 218 | |
|---|
| 221 | | Debug("H245 H245LogicalChannelReject received [%d]\n", channelNumber); |
|---|
| | 219 | Logger::Debug("H245 H245LogicalChannelReject received [%d]\n", channelNumber); |
|---|
| 222 | 220 | |
|---|
| 223 | 221 | //See if channel exist |
|---|
| … | … | |
| 310 | 308 | int channelNumber = pdu.m_forwardLogicalChannelNumber; |
|---|
| 311 | 309 | |
|---|
| 312 | | Debug("H245 H245OpenLogicalChannel received [%d]\n", channelNumber); |
|---|
| | 310 | Logger::Debug("H245 H245OpenLogicalChannel received [%d]\n", channelNumber); |
|---|
| 313 | 311 | |
|---|
| 314 | 312 | //See if channel exist |
|---|
| … | … | |
| 352 | 350 | int channelNumber = pdu.m_forwardLogicalChannelNumber; |
|---|
| 353 | 351 | |
|---|
| 354 | | Debug("H245 H245LogicalChannelReject received [%d]\n", channelNumber); |
|---|
| | 352 | Logger::Debug("H245 H245LogicalChannelReject received [%d]\n", channelNumber); |
|---|
| 355 | 353 | |
|---|
| 356 | 354 | //See if channel exist |
|---|
| … | … | |
| 398 | 396 | int channelNumber = pdu.m_forwardLogicalChannelNumber; |
|---|
| 399 | 397 | |
|---|
| 400 | | Debug("H245 H245LogicalChannelReject received [%d]\n", channelNumber); |
|---|
| | 398 | Logger::Debug("H245 H245LogicalChannelReject received [%d]\n", channelNumber); |
|---|
| 401 | 399 | |
|---|
| 402 | 400 | //See if channel exist |
|---|
| … | … | |
| 426 | 424 | int channelNumber = pdu.m_forwardLogicalChannelNumber; |
|---|
| 427 | 425 | |
|---|
| 428 | | Debug("H245 H245LogicalChannelReject received [%d]\n", channelNumber); |
|---|
| | 426 | Logger::Debug("H245 H245LogicalChannelReject received [%d]\n", channelNumber); |
|---|
| 429 | 427 | |
|---|
| 430 | 428 | //See if channel exist |
|---|
| … | … | |
| 451 | 449 | int channelNumber = pdu.m_forwardLogicalChannelNumber; |
|---|
| 452 | 450 | |
|---|
| 453 | | Debug("H245 H245LogicalChannelReject received [%d]\n", channelNumber); |
|---|
| | 451 | Logger::Debug("H245 H245LogicalChannelReject received [%d]\n", channelNumber); |
|---|
| 454 | 452 | |
|---|
| 455 | 453 | //See if channel exist |
|---|
| … | … | |
| 476 | 474 | int channelNumber = pdu.m_forwardLogicalChannelNumber; |
|---|
| 477 | 475 | |
|---|
| 478 | | Debug("H245 H245LogicalChannelReject received [%d]\n", channelNumber); |
|---|
| | 476 | Logger::Debug("H245 H245LogicalChannelReject received [%d]\n", channelNumber); |
|---|
| 479 | 477 | |
|---|
| 480 | 478 | //See if channel exist |
|---|
| … | … | |
| 501 | 499 | int channelNumber = pdu.m_forwardLogicalChannelNumber; |
|---|
| 502 | 500 | |
|---|
| 503 | | Debug("H245 H245LogicalChannelReject received [%d]\n", channelNumber); |
|---|
| | 501 | Logger::Debug("H245 H245LogicalChannelReject received [%d]\n", channelNumber); |
|---|
| 504 | 502 | |
|---|
| 505 | 503 | //See if channel exist |
|---|
| r196 |
r198 |
|
| 21 | 21 | */ |
|---|
| 22 | 22 | #include "H245MasterSlave.h" |
|---|
| 23 | | |
|---|
| 24 | | #define Debug printf |
|---|
| | 23 | #include "log.h" |
|---|
| 25 | 24 | |
|---|
| 26 | 25 | H245MasterSlave::H245MasterSlave(H245Connection &con):H245Negotiator(con) |
|---|
| … | … | |
| 40 | 39 | BOOL H245MasterSlave::Request() |
|---|
| 41 | 40 | { |
|---|
| 42 | | Debug("H245 Request MasterSlaveDetermination\n"); |
|---|
| | 41 | Logger::Debug("H245 Request MasterSlaveDetermination\n"); |
|---|
| 43 | 42 | |
|---|
| 44 | 43 | //If already processing |
|---|
| … | … | |
| 64 | 63 | { |
|---|
| 65 | 64 | //Debug |
|---|
| 66 | | Debug("H245 MasterSlaveDetermination\n"); |
|---|
| | 65 | Logger::Debug("H245 MasterSlaveDetermination\n"); |
|---|
| 67 | 66 | |
|---|
| 68 | 67 | H324ControlPDU reply; |
|---|
| … | … | |
| 150 | 149 | BOOL H245MasterSlave::HandleAck(const H245_MasterSlaveDeterminationAck & pdu) |
|---|
| 151 | 150 | { |
|---|
| 152 | | Debug("H245 MasterSlave Ack\n"); |
|---|
| | 151 | Logger::Debug("H245 MasterSlave Ack\n"); |
|---|
| 153 | 152 | |
|---|
| 154 | 153 | MasterSlaveStatus newStatus; |
|---|
| … | … | |
| 192 | 191 | { |
|---|
| 193 | 192 | |
|---|
| 194 | | Debug("H245 Received MasterSlaveDeterminationReject\n"); |
|---|
| | 193 | Logger::Debug("H245 Received MasterSlaveDeterminationReject\n"); |
|---|
| 195 | 194 | |
|---|
| 196 | 195 | //Reply |
|---|
| … | … | |
| 234 | 233 | BOOL H245MasterSlave::HandleRelease(const H245_MasterSlaveDeterminationRelease & /*pdu*/) |
|---|
| 235 | 234 | { |
|---|
| 236 | | Debug("H245 Received MasterSlaveDeterminationRelease\n"); |
|---|
| | 235 | Logger::Debug("H245 Received MasterSlaveDeterminationRelease\n"); |
|---|
| 237 | 236 | |
|---|
| 238 | 237 | if (state == e_Idle) |
|---|
| r196 |
r198 |
|
| 21 | 21 | */ |
|---|
| 22 | 22 | #include "H245MuxTable.h" |
|---|
| 23 | | |
|---|
| 24 | | #define Debug printf |
|---|
| | 23 | #include "log.h" |
|---|
| 25 | 24 | |
|---|
| 26 | 25 | H245MuxTable::H245MuxTable(H245Connection & con) |
|---|
| … | … | |
| 44 | 43 | BOOL H245MuxTable::TransferRequest(H223MuxTable& table) |
|---|
| 45 | 44 | { |
|---|
| 46 | | Debug("H245 MultiplexEntrySend\n"); |
|---|
| | 45 | Logger::Debug("H245 MultiplexEntrySend\n"); |
|---|
| 47 | 46 | |
|---|
| 48 | 47 | //If not in idle |
|---|
| … | … | |
| 72 | 71 | BOOL H245MuxTable::HandleAck(const H245_MultiplexEntrySendAck & pdu) |
|---|
| 73 | 72 | { |
|---|
| 74 | | Debug("H245 MultiplexEntrySend accepted\n"); |
|---|
| | 73 | Logger::Debug("H245 MultiplexEntrySend accepted\n"); |
|---|
| 75 | 74 | |
|---|
| 76 | 75 | //If already idle |
|---|
| … | … | |
| 102 | 101 | BOOL H245MuxTable::HandleReject(const H245_MultiplexEntrySendReject & pdu) |
|---|
| 103 | 102 | { |
|---|
| 104 | | Debug("H245 MultiplexEntrySend rejected\n"); |
|---|
| | 103 | Logger::Debug("H245 MultiplexEntrySend rejected\n"); |
|---|
| 105 | 104 | |
|---|
| 106 | 105 | //If already idle |
|---|
| … | … | |
| 135 | 134 | BOOL H245MuxTable::HandleRequest(const H245_MultiplexEntrySend & pdu) |
|---|
| 136 | 135 | { |
|---|
| 137 | | Debug("H245 MultiplexEntrySend request\n"); |
|---|
| | 136 | Logger::Debug("H245 MultiplexEntrySend request\n"); |
|---|
| 138 | 137 | |
|---|
| 139 | 138 | //Create table |
|---|
| r196 |
r198 |
|
| 21 | 21 | */ |
|---|
| 22 | 22 | #include "H245RoundTrip.h" |
|---|
| 23 | | |
|---|
| 24 | | #define Debug printf |
|---|
| | 23 | #include "log.h" |
|---|
| 25 | 24 | |
|---|
| 26 | 25 | H245RoundTripDelay::H245RoundTripDelay(H245Connection & con) |
|---|
| … | … | |
| 29 | 28 | awaitingResponse = FALSE; |
|---|
| 30 | 29 | sequenceNumber = 0; |
|---|
| 31 | | retryCount = 1; |
|---|
| 32 | 30 | } |
|---|
| 33 | 31 | |
|---|
| … | … | |
| 38 | 36 | BOOL H245RoundTripDelay::Start() |
|---|
| 39 | 37 | { |
|---|
| 40 | | Debug("H245 Started round trip delay\n"); |
|---|
| | 38 | Logger::Debug("H245 Started round trip delay\n"); |
|---|
| 41 | 39 | |
|---|
| 42 | 40 | sequenceNumber = (sequenceNumber + 1)%256; |
|---|
| … | … | |
| 46 | 44 | |
|---|
| 47 | 45 | pdu.BuildRoundTripDelayRequest(sequenceNumber); |
|---|
| | 46 | |
|---|
| 48 | 47 | if (!connection.WriteControlPDU(pdu)) |
|---|
| 49 | 48 | return FALSE; |
|---|
| 50 | | |
|---|
| 51 | | tripStartTime = PTimer::Tick(); |
|---|
| 52 | 49 | |
|---|
| 53 | 50 | return TRUE; |
|---|
| … | … | |
| 57 | 54 | BOOL H245RoundTripDelay::HandleRequest(const H245_RoundTripDelayRequest & pdu) |
|---|
| 58 | 55 | { |
|---|
| 59 | | Debug("H245 Started round trip delay"); |
|---|
| | 56 | Logger::Debug("H245 Started round trip delay"); |
|---|
| 60 | 57 | |
|---|
| 61 | 58 | H324ControlPDU reply; |
|---|
| | 59 | |
|---|
| 62 | 60 | reply.BuildRoundTripDelayResponse(pdu.m_sequenceNumber); |
|---|
| | 61 | |
|---|
| 63 | 62 | return connection.WriteControlPDU(reply); |
|---|
| 64 | 63 | } |
|---|
| … | … | |
| 66 | 65 | BOOL H245RoundTripDelay::HandleResponse(const H245_RoundTripDelayResponse & pdu) |
|---|
| 67 | 66 | { |
|---|
| 68 | | PTimeInterval tripEndTime = PTimer::Tick(); |
|---|
| 69 | | |
|---|
| 70 | | Debug("H245 Handling round trip delay\n"); |
|---|
| | 67 | Logger::Debug("H245 Handling round trip delay\n"); |
|---|
| 71 | 68 | |
|---|
| 72 | 69 | if (awaitingResponse && pdu.m_sequenceNumber == sequenceNumber) |
|---|
| 73 | 70 | { |
|---|
| 74 | 71 | awaitingResponse = FALSE; |
|---|
| 75 | | roundTripTime = tripEndTime - tripStartTime; |
|---|
| 76 | | retryCount = 3; |
|---|
| 77 | 72 | |
|---|
| 78 | 73 | //Set event |
|---|
| 79 | | connection.OnEvent(Event(roundTripTime)); |
|---|
| | 74 | connection.OnEvent(Event()); |
|---|
| 80 | 75 | } |
|---|
| 81 | 76 | |
|---|
| 82 | 77 | return TRUE; |
|---|
| 83 | 78 | } |
|---|
| 84 | | |
|---|
| 85 | | /* |
|---|
| 86 | | void H245RoundTripDelay::HandleTimeout(PTimer &, INT) |
|---|
| 87 | | { |
|---|
| 88 | | // PWaitAndSignal wait(mutex); |
|---|
| 89 | | |
|---|
| 90 | | // PTRACE(3, "H245\tTimeout on round trip delay: seq=" << sequenceNumber |
|---|
| 91 | | // << (awaitingResponse ? " awaitingResponse" : " idle")); |
|---|
| 92 | | |
|---|
| 93 | | if (awaitingResponse && retryCount > 0) |
|---|
| 94 | | retryCount--; |
|---|
| 95 | | awaitingResponse = FALSE; |
|---|
| 96 | | |
|---|
| 97 | | connection.OnControlProtocolError(H245Connection::e_RoundTripDelay, "Timeout"); |
|---|
| 98 | | } |
|---|
| 99 | | */ |
|---|
| r3 |
r198 |
|
| 13 | 13 | { |
|---|
| 14 | 14 | public: |
|---|
| 15 | | Event(PTimeInterval &d): delay(d) |
|---|
| | 15 | Event() |
|---|
| 16 | 16 | { |
|---|
| 17 | 17 | source = H245Connection::e_RoundTripDelay; |
|---|
| 18 | 18 | }; |
|---|
| 19 | | PTimeInterval delay; |
|---|
| 20 | 19 | }; |
|---|
| 21 | 20 | |
|---|
| 22 | 21 | public: |
|---|
| 23 | | H245RoundTripDelay(H245Connection & connection); |
|---|
| | 22 | H245RoundTripDelay(H245Connection & connection); |
|---|
| 24 | 23 | virtual ~H245RoundTripDelay(); |
|---|
| 25 | 24 | |
|---|
| 26 | | BOOL Start(); |
|---|
| 27 | | BOOL HandleRequest(const H245_RoundTripDelayRequest & pdu); |
|---|
| 28 | | BOOL HandleResponse(const H245_RoundTripDelayResponse & pdu); |
|---|
| 29 | | /*void HandleTimeout(PTimer &, INT);*/ |
|---|
| 30 | | |
|---|
| 31 | | PTimeInterval GetRoundTripDelay() const { return roundTripTime; } |
|---|
| 32 | | BOOL IsRemoteOffline() const { return retryCount == 0; } |
|---|
| | 25 | BOOL Start(); |
|---|
| | 26 | BOOL HandleRequest(const H245_RoundTripDelayRequest & pdu); |
|---|
| | 27 | BOOL HandleResponse(const H245_RoundTripDelayResponse & pdu); |
|---|
| 33 | 28 | |
|---|
| 34 | 29 | protected: |
|---|
| 35 | | BOOL awaitingResponse; |
|---|
| 36 | | unsigned sequenceNumber; |
|---|
| 37 | | PTimeInterval tripStartTime; |
|---|
| 38 | | PTimeInterval roundTripTime; |
|---|
| 39 | | unsigned retryCount; |
|---|
| | 30 | BOOL awaitingResponse; |
|---|
| | 31 | unsigned sequenceNumber; |
|---|
| 40 | 32 | }; |
|---|
| 41 | 33 | |
|---|
| r196 |
r198 |
|
| 21 | 21 | */ |
|---|
| 22 | 22 | #include "H245TerminalCapability.h" |
|---|
| 23 | | |
|---|
| 24 | | #define Debug printf |
|---|
| | 23 | #include "log.h" |
|---|
| 25 | 24 | |
|---|
| 26 | 25 | H245TerminalCapability::H245TerminalCapability(H245Connection & con) |
|---|
| … | … | |
| 45 | 44 | BOOL H245TerminalCapability::TransferRequest(H245Capabilities* capabilities) |
|---|
| 46 | 45 | { |
|---|
| 47 | | //Debug |
|---|
| 48 | | Debug("H245 TerminalCapabilitySet TransferRequest\n"); |
|---|
| | 46 | //Logger::Debug |
|---|
| | 47 | Logger::Debug("H245 TerminalCapabilitySet TransferRequest\n"); |
|---|
| 49 | 48 | |
|---|
| 50 | 49 | //We are already in progress |
|---|
| … | … | |
| 70 | 69 | BOOL H245TerminalCapability::HandleAck(const H245_TerminalCapabilitySetAck & pdu) |
|---|
| 71 | 70 | { |
|---|
| 72 | | Debug("H245 Received TerminalCapabilitySetAck\n"); |
|---|
| | 71 | Logger::Debug("H245 Received TerminalCapabilitySetAck\n"); |
|---|
| 73 | 72 | |
|---|
| 74 | 73 | //Check sequence number |
|---|
| … | … | |
| 91 | 90 | BOOL H245TerminalCapability::HandleReject(const H245_TerminalCapabilitySetReject & pdu) |
|---|
| 92 | 91 | { |
|---|
| 93 | | Debug("H245 Received TerminalCapabilitySetReject\n"); |
|---|
| | 92 | Logger::Debug("H245 Received TerminalCapabilitySetReject\n"); |
|---|
| 94 | 93 | |
|---|
| 95 | 94 | //Check sequence number |
|---|
| &hel |
| |