Changeset 202

Show
Ignore:
Timestamp:
12/27/07 11:43:52 (9 months ago)
Author:
sip
Message:

Check for golay and check PDU length in demuxer.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • libh324m/src/H223Demuxer.cpp

    r201 r202  
    124124        } 
    125125         
    126         //If the flag is the complement 
    127         if (flag.complement) 
     126        //If the flag is the complement and valid 
     127        if (flag.IsValid() && flag.complement) 
    128128        { 
    129129                //Log 
     
    197197                                //Reset state 
    198198                                state = NONE; 
     199                                //Exit 
     200                                return; 
    199201                        } 
    200202 
     
    205207 
    206208                        //We have a good header go for the pdu 
    207             state = PDU; 
     209                       state = PDU; 
    208210 
    209211                        break; 
     
    219221                                Send(a); 
    220222 
    221                         //If we have a good flag 
    222                         if (!flag.IsValid()
     223                        //While we are in the PDU 
     224                        if (counter<header.mpl
    223225                                //And return 
    224226                                return; 
    225                          
    226                          
     227 
    227228                        //Set end PDU if not stuffing 
    228229                        if(header.mpl) 
    229230                                EndPDU(flag); 
    230231 
    231                         //Start the next PDU 
    232                         StartPDU(flag); 
    233  
    234                         //Clear flag 
    235                         flag.Clear(); 
    236  
    237                         //Clear the header  
    238                         header.Clear(); 
    239  
    240                         //Change state 
    241                         state = HEAD; 
     232                        //If the flag is valid 
     233                        if (flag.IsValid()) 
     234                        { 
     235                                //Start the next PDU 
     236                                StartPDU(flag); 
     237 
     238                                //Clear flag 
     239                                flag.Clear(); 
     240 
     241                                //Clear the header  
     242                                header.Clear(); 
     243 
     244                                //Change state 
     245                                state = HEAD; 
     246                        } else  
     247                                //No header found 
     248                                state = NONE; 
     249                         
    242250                        break; 
    243251        } 
  • libh324m/src/H223Header.cpp

    r196 r202  
    2121 */ 
    2222#include "H223Header.h" 
     23extern "C" { 
     24#include "golay.h" 
     25} 
    2326 
    2427int H223Header::IsComplete() 
     
    2932int H223Header::IsValid() 
    3033{ 
    31         /* 
    32         mc = (header.buffer[0] & 0x1E) >> 1; 
    33         pm = (header.buffer[0] & 0x01); 
    34         */ 
    35          
    3634        //Get the values 
    3735        mc   = buffer[0] & 0x0F; 
     
    3937        pm   = (buffer[1] >> 4) | (buffer[2] << 4); 
    4038 
    41         //Calculate the golay codez 
     39        //Calculate the golay code 
     40        DWORD golay = buffer[2] << 16 | buffer[1] << 8 | buffer[0]; 
     41 
     42        //Decode it 
     43        int code = golay_decode(golay); 
     44 
     45        //Chek it 
     46        if (code==-1) 
     47                //Bad header 
     48                return 0; 
     49 
     50        //Get the values 
     51        mc  = code & 0x0F; 
     52        mpl = code >> 4; 
     53 
     54        //Good header 
    4255        return 1; 
    4356 
  • libh324m/src/H245MuxTable.cpp

    r198 r202  
    147147        table.BuildPDU(entrySend); 
    148148 
    149         cout << "Check \n" << pdux << "\n"; 
    150  
    151149        //Depending on the state 
    152150        switch(inState) 
  • libh324m/src/test/h223dump.cpp

    r13 r202  
    2323                return 1; 
    2424        } 
     25 
     26        //Set login high 
     27        Logger::SetLevel(9); 
    2528 
    2629        //Open file 
     
    5356        //Until end of file 
    5457        while ((len=read(f,buffer,160))>0) 
    55         { 
    56                 //For each byte 
    57                 for (int i=0;i<len;i++) 
    58                          //Demux 
    59                          demuxer.Demultiplex(buffer[i]); 
    60         } 
     58                //Demux 
     59                demuxer.Demultiplex(buffer,len); 
    6160 
    6261        //Close demuxer 
Copyright 2006 - Sergio García Murillo
Powered by Trac - Edgewall Software