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

Comparing gvpe/src/rohc/d_ip.c (file contents):
Revision 1.1 by pcg, Sun Feb 8 06:02:44 2004 UTC vs.
Revision 1.2 by pcg, Sun Feb 8 07:24:25 2004 UTC

34 * other SN number. The decode functions returns some 34 * other SN number. The decode functions returns some
35 * kind of ROHC_ERROR or if it is correct decoded the 35 * kind of ROHC_ERROR or if it is correct decoded the
36 * length of the decoded packet is returned. 36 * length of the decoded packet is returned.
37*/ 37*/
38 38
39#include <asm/byteorder.h>
40
41#include "rohc.h" 39#include "rohc.h"
42#include "decomp.h" 40#include "decomp.h"
43 41
44#include "d_ip.h" 42#include "d_ip.h"
45#include "d_util.h" 43#include "d_util.h"
293 } 291 }
294 // Reset the correction-counter 292 // Reset the correction-counter
295 pro->counter = 0; 293 pro->counter = 0;
296 294
297 // Get and set SN 295 // Get and set SN
298 sn = ntohs(* ((__u16 *)s)); 296 sn = ntohs(* ((u16 *)s));
299 d_lsb_init(&pro->sn, sn, -1); 297 d_lsb_init(&pro->sn, sn, -1);
300 d_ip_id_init(&pro->ip_id1, ntohs(active1->ip.id), sn); 298 d_ip_id_init(&pro->ip_id1, ntohs(active1->ip.id), sn);
301 s += 2; 299 s += 2;
302 context->state = ROHC_FULL_CONTEXT; 300 context->state = ROHC_FULL_CONTEXT;
303 301
762 760
763 if( pro->multiple_ip ){ 761 if( pro->multiple_ip ){
764 size = d_decode_dynamic_ip4(src2, &active2->ip, &active2->rnd, &active2->nbo); 762 size = d_decode_dynamic_ip4(src2, &active2->ip, &active2->rnd, &active2->nbo);
765 src2 += size; payload_size -= size; 763 src2 += size; payload_size -= size;
766 } 764 }
767 sn = ntohs(* ((__u16 *)src2)); 765 sn = ntohs(* ((u16 *)src2));
768 d_lsb_init(&pro->sn, sn, -1); 766 d_lsb_init(&pro->sn, sn, -1);
769 d_ip_id_init(&pro->ip_id1,ntohs(active1->ip.id), sn); 767 d_ip_id_init(&pro->ip_id1,ntohs(active1->ip.id), sn);
770 syncronize(pro); 768 syncronize(pro);
771 // reset the correction-counter 769 // reset the correction-counter
772 pro->counter = 0; 770 pro->counter = 0;
820 int field_counter = 0; 818 int field_counter = 0;
821 819
822 *sn = d_lsb_decode(&pro->sn, sn_bits, number_of_sn_bits); 820 *sn = d_lsb_decode(&pro->sn, sn_bits, number_of_sn_bits);
823 821
824 if (active1->rnd) { 822 if (active1->rnd) {
825 *id = ntohs(*((__u16 *)src)); 823 *id = ntohs(*((u16 *)src));
826 src += 2; field_counter +=2; *payload_size -= 2; 824 src += 2; field_counter +=2; *payload_size -= 2;
827 825
828 } else { 826 } else {
829 if(number_of_id_bits) 827 if(number_of_id_bits)
830 *id = d_ip_id_decode(&pro->ip_id1, *id, number_of_id_bits, *sn); 828 *id = d_ip_id_decode(&pro->ip_id1, *id, number_of_id_bits, *sn);
834 832
835 // If multiple ip header 833 // If multiple ip header
836 if (pro->multiple_ip){ 834 if (pro->multiple_ip){
837 835
838 if (active2->rnd) { 836 if (active2->rnd) {
839 *id2 = ntohs(*((__u16 *)src)); 837 *id2 = ntohs(*((u16 *)src));
840 838
841 src +=2; field_counter +=2; *payload_size -= 2; 839 src +=2; field_counter +=2; *payload_size -= 2;
842 } else { 840 } else {
843 *id2 = d_ip_id_decode(&pro->ip_id2, 0, 0, *sn); 841 *id2 = d_ip_id_decode(&pro->ip_id2, 0, 0, *sn);
844 } 842 }
956 } 954 }
957 955
958 956
959 // Random IP ID ? 957 // Random IP ID ?
960 if (active1->rnd) { 958 if (active1->rnd) {
961 *id = ntohs(*((__u16 *)src2)); 959 *id = ntohs(*((u16 *)src2));
962 src2 +=2; field_counter +=2; *payload_size -= 2; 960 src2 +=2; field_counter +=2; *payload_size -= 2;
963 } 961 }
964 962
965 // Multiple ip-header 963 // Multiple ip-header
966 964
967 if (( pro->multiple_ip )&&( active2->rnd )){ 965 if (( pro->multiple_ip )&&( active2->rnd )){
968 *id2 = ntohs(*((__u16 *)src2)); 966 *id2 = ntohs(*((u16 *)src2));
969 src2 +=2; field_counter +=2; *payload_size -= 2; 967 src2 +=2; field_counter +=2; *payload_size -= 2;
970 } 968 }
971 969
972 970
973 // Header write 971 // Header write
1080 &active1->rnd, &active1->nbo); 1078 &active1->rnd, &active1->nbo);
1081 fields += size; 1079 fields += size;
1082 } 1080 }
1083 if (I) { 1081 if (I) {
1084 if(pro->multiple_ip){ 1082 if(pro->multiple_ip){
1085 active2->ip.id = *((__u16 *)fields); 1083 active2->ip.id = *((u16 *)fields);
1086 fields += 2; 1084 fields += 2;
1087 *update_id2 = 1; 1085 *update_id2 = 1;
1088 }else{ 1086 }else{
1089 active1->ip.id = *((__u16 *)fields); 1087 active1->ip.id = *((u16 *)fields);
1090 fields += 2; 1088 fields += 2;
1091 *ip_id_changed = 1; 1089 *ip_id_changed = 1;
1092 } 1090 }
1093 } 1091 }
1094 if (ip2) { 1092 if (ip2) {
1214 } 1212 }
1215 *nbo = GET_BIT_2(flags); 1213 *nbo = GET_BIT_2(flags);
1216 *rnd = GET_BIT_1(flags); 1214 *rnd = GET_BIT_1(flags);
1217 1215
1218 if (GET_BIT_0(flags)) { 1216 if (GET_BIT_0(flags)) {
1219 ip->id = *((__u16 *)fields); 1217 ip->id = *((u16 *)fields);
1220 fields += 2; size += 2; 1218 fields += 2; size += 2;
1221 *updated_id = 1; 1219 *updated_id = 1;
1222 } 1220 }
1223 return size; 1221 return size;
1224} 1222}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines