… | |
… | |
189 | if((dest->version)!=4) |
189 | if((dest->version)!=4) |
190 | return -1; |
190 | return -1; |
191 | data++; |
191 | data++; |
192 | dest->protocol = GET_BIT_0_7(data); |
192 | dest->protocol = GET_BIT_0_7(data); |
193 | data++; |
193 | data++; |
194 | dest->saddr = *((__u32 *)data); |
194 | dest->saddr = *((u32 *)data); |
195 | data += 4; |
195 | data += 4; |
196 | dest->daddr = *((__u32 *)data); |
196 | dest->daddr = *((u32 *)data); |
197 | return 10; |
197 | return 10; |
198 | } |
198 | } |
199 | |
199 | |
200 | // Decode the static part in a udp rohc packet and store it in a udp-structure |
200 | // Decode the static part in a udp rohc packet and store it in a udp-structure |
201 | // Return the number of used bytes |
201 | // Return the number of used bytes |
202 | int d_decode_static_udp(const unsigned char *data, struct udphdr * dest) |
202 | int d_decode_static_udp(const unsigned char *data, struct udphdr * dest) |
203 | { |
203 | { |
204 | dest-> source = *((__u16 *)data); |
204 | dest-> source = *((u16 *)data); |
205 | data += 2; |
205 | data += 2; |
206 | dest-> dest = *((__u16 *)data); |
206 | dest-> dest = *((u16 *)data); |
207 | return 4; |
207 | return 4; |
208 | } |
208 | } |
209 | |
209 | |
210 | // Decode the dynamic part in a ipv4 rohc packet and store it in a ip-structure |
210 | // Decode the dynamic part in a ipv4 rohc packet and store it in a ip-structure |
211 | // Return the number of used bytes |
211 | // Return the number of used bytes |
… | |
… | |
214 | { |
214 | { |
215 | dest->tos = GET_BIT_0_7(data); |
215 | dest->tos = GET_BIT_0_7(data); |
216 | data++; |
216 | data++; |
217 | dest->ttl = GET_BIT_0_7(data); |
217 | dest->ttl = GET_BIT_0_7(data); |
218 | data++; |
218 | data++; |
219 | dest-> id = *((__u16 *)data); |
219 | dest-> id = *((u16 *)data); |
220 | data += 2; |
220 | data += 2; |
221 | if(GET_BIT_7(data)){ |
221 | if(GET_BIT_7(data)){ |
222 | dest->frag_off = htons(0x4000); |
222 | dest->frag_off = htons(0x4000); |
223 | }else{ |
223 | }else{ |
224 | dest->frag_off = htons(0x0000); |
224 | dest->frag_off = htons(0x0000); |
… | |
… | |
231 | |
231 | |
232 | // Decode the dynamic part in a udp rohc packet and store it in a udp-structure |
232 | // Decode the dynamic part in a udp rohc packet and store it in a udp-structure |
233 | // Return the number of used bytes |
233 | // Return the number of used bytes |
234 | int d_decode_dynamic_udp(const unsigned char *data, struct udphdr * dest) |
234 | int d_decode_dynamic_udp(const unsigned char *data, struct udphdr * dest) |
235 | { |
235 | { |
236 | dest-> check = *((__u16 *)data); |
236 | dest-> check = *((u16 *)data); |
237 | return 2; |
237 | return 2; |
238 | } |
238 | } |
239 | |
239 | |
240 | // Decode the dynamic part in a udp-lite rohc packet and store it in a udp-structure |
240 | // Decode the dynamic part in a udp-lite rohc packet and store it in a udp-structure |
241 | // Return the number of used bytes |
241 | // Return the number of used bytes |
242 | int d_decode_dynamic_udp_lite(const unsigned char *data, struct udphdr * dest) |
242 | int d_decode_dynamic_udp_lite(const unsigned char *data, struct udphdr * dest) |
243 | { |
243 | { |
244 | dest-> len = *((__u16 *)data); |
244 | dest-> len = *((u16 *)data); |
245 | data += 2; |
245 | data += 2; |
246 | dest-> check = *((__u16 *)data); |
246 | dest-> check = *((u16 *)data); |
247 | return 4; |
247 | return 4; |
248 | } |
248 | } |
249 | |
249 | |
250 | |
250 | |
251 | // Initiate the lsb struct |
251 | // Initiate the lsb struct |