ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gvpe/src/rohc/d_udp_lite.c
(Generate patch)

Comparing gvpe/src/rohc/d_udp_lite.c (file contents):
Revision 1.1 by pcg, Sun Feb 8 06:02:44 2004 UTC vs.
Revision 1.3 by pcg, Tue Apr 26 00:55:56 2005 UTC

23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 GNU General Public License for more details. 24 GNU General Public License for more details.
25 25
26 You should have received a copy of the GNU General Public License 26 You should have received a copy of the GNU General Public License
27 along with this program; if not, write to the Free Software 27 along with this program; if not, write to the Free Software
28 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 28 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
29*/ 29*/
30 30
31// The UDP-lite profile in the decompressor 31// The UDP-lite profile in the decompressor
32
33#include <asm/byteorder.h>
34 32
35#include "rohc.h" 33#include "rohc.h"
36#include "decomp.h" 34#include "decomp.h"
37 35
36#include "d_ip.h"
38#include "d_udp_lite.h" 37#include "d_udp_lite.h"
39#include "d_util.h" 38#include "d_util.h"
40#include "comp.h" 39#include "comp.h"
41#include "c_util.h" 40#include "c_util.h"
42 41
319 //debug 318 //debug
320 rohc_debugf(2,"(decomp) coverage present %d\n",pro->coverage_present); 319 rohc_debugf(2,"(decomp) coverage present %d\n",pro->coverage_present);
321 rohc_debugf(2,"(decomp) coverage inferred %d\n",pro->coverage_inferred); 320 rohc_debugf(2,"(decomp) coverage inferred %d\n",pro->coverage_inferred);
322 321
323 // Get and set SN 322 // Get and set SN
324 sn = ntohs(* ((__u16 *)s)); 323 sn = ntohs(* ((u16 *)s));
325 d_lsb_init(&pro->sn, sn, -1); 324 d_lsb_init(&pro->sn, sn, -1);
326 d_ip_id_init(&pro->ip_id1, ntohs(active1->ip.id), sn); 325 d_ip_id_init(&pro->ip_id1, ntohs(active1->ip.id), sn);
327 s += 2; 326 s += 2;
328 327
329 // If multiple-ip-header 328 // If multiple-ip-header
838 pro->coverage_inferred = (udp_length == ntohs(active1->udp.len)); 837 pro->coverage_inferred = (udp_length == ntohs(active1->udp.len));
839 838
840 //debug 839 //debug
841 rohc_debugf(2,"(decomp) coverage present %d\n",pro->coverage_present); 840 rohc_debugf(2,"(decomp) coverage present %d\n",pro->coverage_present);
842 rohc_debugf(2,"(decomp) coverage inferred %d\n",pro->coverage_inferred); 841 rohc_debugf(2,"(decomp) coverage inferred %d\n",pro->coverage_inferred);
843 sn = ntohs(* ((__u16 *)src2)); 842 sn = ntohs(* ((u16 *)src2));
844 d_lsb_init(&pro->sn, sn, -1); 843 d_lsb_init(&pro->sn, sn, -1);
845 d_ip_id_init(&pro->ip_id1,ntohs(active1->ip.id), sn); 844 d_ip_id_init(&pro->ip_id1,ntohs(active1->ip.id), sn);
846 845
847 udp_lite_syncronize(pro); 846 udp_lite_syncronize(pro);
848 // reset the correction-counter 847 // reset the correction-counter
902 int coverage = 0; 901 int coverage = 0;
903 902
904 *sn = d_lsb_decode(&pro->sn, sn_bits, number_of_sn_bits); 903 *sn = d_lsb_decode(&pro->sn, sn_bits, number_of_sn_bits);
905 904
906 if (active1->rnd) { 905 if (active1->rnd) {
907 *id = ntohs(*((__u16 *)src)); 906 *id = ntohs(*((u16 *)src));
908 src += 2; field_counter +=2; *payload_size -= 2; 907 src += 2; field_counter +=2; *payload_size -= 2;
909 908
910 } else { 909 } else {
911 if(number_of_id_bits) 910 if(number_of_id_bits)
912 *id = d_ip_id_decode(&pro->ip_id1, *id, number_of_id_bits, *sn); 911 *id = d_ip_id_decode(&pro->ip_id1, *id, number_of_id_bits, *sn);
916 915
917 // If multiple ip header 916 // If multiple ip header
918 if (pro->multiple_ip){ 917 if (pro->multiple_ip){
919 918
920 if (active2->rnd) { 919 if (active2->rnd) {
921 *id2 = ntohs(*((__u16 *)src)); 920 *id2 = ntohs(*((u16 *)src));
922 921
923 src +=2; field_counter +=2; *payload_size -= 2; 922 src +=2; field_counter +=2; *payload_size -= 2;
924 } else { 923 } else {
925 *id2 = d_ip_id_decode(&pro->ip_id2, 0, 0, *sn); 924 *id2 = d_ip_id_decode(&pro->ip_id2, 0, 0, *sn);
926 } 925 }
927 } 926 }
928 927
929 // coverage checksum field 928 // coverage checksum field
930 if ((pro->coverage_present)||(pro->ce_packet)){ 929 if ((pro->coverage_present)||(pro->ce_packet)){
931 coverage = ntohs(* ((__u16 *)src)); 930 coverage = ntohs(* ((u16 *)src));
932 if(pro->ce_packet == PACKAGE_CE_OFF){ 931 if(pro->ce_packet == PACKAGE_CE_OFF){
933 active1->udp.len = * ((__u16 *)src); 932 active1->udp.len = * ((u16 *)src);
934 pro->coverage_inferred = ((*payload_size - 4 + sizeof(struct udphdr)) == ntohs(active1->udp.len)); 933 pro->coverage_inferred = ((*payload_size - 4 + sizeof(struct udphdr)) == ntohs(active1->udp.len));
935 } 934 }
936 src += 2; field_counter +=2; *payload_size -= 2; 935 src += 2; field_counter +=2; *payload_size -= 2;
937 } 936 }
938 937
939 //debug 938 //debug
940 rohc_debugf(2,"(decomp) coverage present %d\n",pro->coverage_present); 939 rohc_debugf(2,"(decomp) coverage present %d\n",pro->coverage_present);
941 rohc_debugf(2,"(decomp) coverage inferred %d\n",pro->coverage_inferred); 940 rohc_debugf(2,"(decomp) coverage inferred %d\n",pro->coverage_inferred);
942 941
943 //checksum 942 //checksum
944 checksum = *((__u16 *)src); 943 checksum = *((u16 *)src);
945 src +=2; field_counter +=2; *payload_size -= 2; 944 src +=2; field_counter +=2; *payload_size -= 2;
946 945
947 rohc_debugf(2,"(decomp) udp checksum %x payload size = %d\n",checksum,*payload_size); 946 rohc_debugf(2,"(decomp) udp checksum %x payload size = %d\n",checksum,*payload_size);
948 // Header write 947 // Header write
949 if (pro->multiple_ip){ 948 if (pro->multiple_ip){
1059 } 1058 }
1060 1059
1061 1060
1062 // Random IP ID ? 1061 // Random IP ID ?
1063 if (active1->rnd) { 1062 if (active1->rnd) {
1064 *id = ntohs(*((__u16 *)src2)); 1063 *id = ntohs(*((u16 *)src2));
1065 src2 +=2; field_counter +=2; *payload_size -= 2; 1064 src2 +=2; field_counter +=2; *payload_size -= 2;
1066 } 1065 }
1067 1066
1068 // Multiple ip-header 1067 // Multiple ip-header
1069 1068
1070 if (( pro->multiple_ip )&&( active2->rnd )){ 1069 if (( pro->multiple_ip )&&( active2->rnd )){
1071 1070
1072 *id2 = ntohs(*((__u16 *)src2)); 1071 *id2 = ntohs(*((u16 *)src2));
1073 src2 +=2; field_counter +=2; *payload_size -= 2; 1072 src2 +=2; field_counter +=2; *payload_size -= 2;
1074 } 1073 }
1075 1074
1076 1075
1077 // coverage checksum field 1076 // coverage checksum field
1078 if ((pro->coverage_present)||(pro->ce_packet)){ 1077 if ((pro->coverage_present)||(pro->ce_packet)){
1079 coverage = ntohs(* ((__u16 *)src2)); 1078 coverage = ntohs(* ((u16 *)src2));
1080 if(pro->ce_packet == PACKAGE_CE_OFF){ 1079 if(pro->ce_packet == PACKAGE_CE_OFF){
1081 active1->udp.len = * ((__u16 *)src2); 1080 active1->udp.len = * ((u16 *)src2);
1082 pro->coverage_inferred = ((*payload_size - 4 + sizeof(struct udphdr)) == ntohs(active1->udp.len)); 1081 pro->coverage_inferred = ((*payload_size - 4 + sizeof(struct udphdr)) == ntohs(active1->udp.len));
1083 1082
1084 } 1083 }
1085 1084
1086 src2 += 2; field_counter +=2; *payload_size -= 2; 1085 src2 += 2; field_counter +=2; *payload_size -= 2;
1089 //debug 1088 //debug
1090 rohc_debugf(2,"(decomp) coverage present %d\n",pro->coverage_present); 1089 rohc_debugf(2,"(decomp) coverage present %d\n",pro->coverage_present);
1091 rohc_debugf(2,"(decomp) coverage inferred %d\n",pro->coverage_inferred); 1090 rohc_debugf(2,"(decomp) coverage inferred %d\n",pro->coverage_inferred);
1092 1091
1093 1092
1094 checksum = *((__u16 *)src2); 1093 checksum = *((u16 *)src2);
1095 src2 +=2; field_counter +=2; *payload_size -= 2; 1094 src2 +=2; field_counter +=2; *payload_size -= 2;
1096 1095
1097 1096
1098 // Header write 1097 // Header write
1099 if (pro->multiple_ip){ 1098 if (pro->multiple_ip){
1207 &active1->rnd, &active1->nbo); 1206 &active1->rnd, &active1->nbo);
1208 fields += size; 1207 fields += size;
1209 } 1208 }
1210 if (I) { 1209 if (I) {
1211 if(pro->multiple_ip){ 1210 if(pro->multiple_ip){
1212 active2->ip.id = *((__u16 *)fields); 1211 active2->ip.id = *((u16 *)fields);
1213 fields += 2; 1212 fields += 2;
1214 *update_id2 = 1; 1213 *update_id2 = 1;
1215 }else{ 1214 }else{
1216 active1->ip.id = *((__u16 *)fields); 1215 active1->ip.id = *((u16 *)fields);
1217 fields += 2; 1216 fields += 2;
1218 *ip_id_changed = 1; 1217 *ip_id_changed = 1;
1219 } 1218 }
1220 } 1219 }
1221 if (ip2) { 1220 if (ip2) {
1341 } 1340 }
1342 *nbo = GET_BIT_2(flags); 1341 *nbo = GET_BIT_2(flags);
1343 *rnd = GET_BIT_1(flags); 1342 *rnd = GET_BIT_1(flags);
1344 1343
1345 if (GET_BIT_0(flags)) { 1344 if (GET_BIT_0(flags)) {
1346 ip->id = *((__u16 *)fields); 1345 ip->id = *((u16 *)fields);
1347 fields += 2; size += 2; 1346 fields += 2; size += 2;
1348 *updated_id = 1; 1347 *updated_id = 1;
1349 } 1348 }
1350 return size; 1349 return size;
1351} 1350}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines