Import 2.4.0-test4
[davej-history.git] / drivers / net / slhc.c
blob410bb59c94542e05f4eacd826ae7381a07e0d77b
1 /*
2 * Routines to compress and uncompress tcp packets (for transmission
3 * over low speed serial lines).
5 * Copyright (c) 1989 Regents of the University of California.
6 * All rights reserved.
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by the University of California, Berkeley. The name of the
14 * University may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 * Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989:
21 * - Initial distribution.
24 * modified for KA9Q Internet Software Package by
25 * Katie Stevens (dkstevens@ucdavis.edu)
26 * University of California, Davis
27 * Computing Services
28 * - 01-31-90 initial adaptation (from 1.19)
29 * PPP.05 02-15-90 [ks]
30 * PPP.08 05-02-90 [ks] use PPP protocol field to signal compression
31 * PPP.15 09-90 [ks] improve mbuf handling
32 * PPP.16 11-02 [karn] substantially rewritten to use NOS facilities
34 * - Feb 1991 Bill_Simpson@um.cc.umich.edu
35 * variable number of conversation slots
36 * allow zero or one slots
37 * separate routines
38 * status display
39 * - Jul 1994 Dmitry Gorodchanin
40 * Fixes for memory leaks.
41 * - Oct 1994 Dmitry Gorodchanin
42 * Modularization.
43 * - Jan 1995 Bjorn Ekwall
44 * Use ip_fast_csum from ip.h
45 * - July 1995 Christos A. Polyzols
46 * Spotted bug in tcp option checking
49 * This module is a difficult issue. It's clearly inet code but it's also clearly
50 * driver code belonging close to PPP and SLIP
53 #include <linux/config.h>
54 #include <linux/module.h>
55 #include <linux/types.h>
56 #include <linux/string.h>
57 #include <linux/errno.h>
58 #include <linux/kernel.h>
59 #include <net/slhc_vj.h>
61 #ifdef CONFIG_INET
62 /* Entire module is for IP only */
63 #include <linux/sched.h>
64 #include <linux/mm.h>
65 #include <linux/socket.h>
66 #include <linux/sockios.h>
67 #include <linux/termios.h>
68 #include <linux/in.h>
69 #include <linux/fcntl.h>
70 #include <linux/inet.h>
71 #include <linux/netdevice.h>
72 #include <net/ip.h>
73 #include <net/protocol.h>
74 #include <net/icmp.h>
75 #include <net/tcp.h>
76 #include <linux/skbuff.h>
77 #include <net/sock.h>
78 #include <linux/timer.h>
79 #include <asm/system.h>
80 #include <asm/uaccess.h>
81 #include <net/checksum.h>
82 #include <asm/unaligned.h>
84 int last_retran;
86 static unsigned char *encode(unsigned char *cp, unsigned short n);
87 static long decode(unsigned char **cpp);
88 static unsigned char * put16(unsigned char *cp, unsigned short x);
89 static unsigned short pull16(unsigned char **cpp);
91 /* Initialize compression data structure
92 * slots must be in range 0 to 255 (zero meaning no compression)
94 struct slcompress *
95 slhc_init(int rslots, int tslots)
97 register short i;
98 register struct cstate *ts;
99 struct slcompress *comp;
101 MOD_INC_USE_COUNT;
102 comp = (struct slcompress *)kmalloc(sizeof(struct slcompress),
103 GFP_KERNEL);
104 if (! comp)
105 goto out_fail;
106 memset(comp, 0, sizeof(struct slcompress));
108 if ( rslots > 0 && rslots < 256 ) {
109 size_t rsize = rslots * sizeof(struct cstate);
110 comp->rstate = (struct cstate *) kmalloc(rsize, GFP_KERNEL);
111 if (! comp->rstate)
112 goto out_free;
113 memset(comp->rstate, 0, rsize);
114 comp->rslot_limit = rslots - 1;
117 if ( tslots > 0 && tslots < 256 ) {
118 size_t tsize = tslots * sizeof(struct cstate);
119 comp->tstate = (struct cstate *) kmalloc(tsize, GFP_KERNEL);
120 if (! comp->tstate)
121 goto out_free2;
122 memset(comp->tstate, 0, tsize);
123 comp->tslot_limit = tslots - 1;
126 comp->xmit_oldest = 0;
127 comp->xmit_current = 255;
128 comp->recv_current = 255;
130 * don't accept any packets with implicit index until we get
131 * one with an explicit index. Otherwise the uncompress code
132 * will try to use connection 255, which is almost certainly
133 * out of range
135 comp->flags |= SLF_TOSS;
137 if ( tslots > 0 ) {
138 ts = comp->tstate;
139 for(i = comp->tslot_limit; i > 0; --i){
140 ts[i].cs_this = i;
141 ts[i].next = &(ts[i - 1]);
143 ts[0].next = &(ts[comp->tslot_limit]);
144 ts[0].cs_this = 0;
146 return comp;
148 out_free2:
149 kfree((unsigned char *)comp->rstate);
150 out_free:
151 kfree((unsigned char *)comp);
152 out_fail:
153 MOD_DEC_USE_COUNT;
154 return NULL;
158 /* Free a compression data structure */
159 void
160 slhc_free(struct slcompress *comp)
162 if ( comp == NULLSLCOMPR )
163 return;
165 if ( comp->tstate != NULLSLSTATE )
166 kfree( comp->tstate );
168 if ( comp->rstate != NULLSLSTATE )
169 kfree( comp->rstate );
171 kfree( comp );
172 MOD_DEC_USE_COUNT;
176 /* Put a short in host order into a char array in network order */
177 static inline unsigned char *
178 put16(unsigned char *cp, unsigned short x)
180 *cp++ = x >> 8;
181 *cp++ = x;
183 return cp;
187 /* Encode a number */
188 unsigned char *
189 encode(unsigned char *cp, unsigned short n)
191 if(n >= 256 || n == 0){
192 *cp++ = 0;
193 cp = put16(cp,n);
194 } else {
195 *cp++ = n;
197 return cp;
200 /* Pull a 16-bit integer in host order from buffer in network byte order */
201 static unsigned short
202 pull16(unsigned char **cpp)
204 short rval;
206 rval = *(*cpp)++;
207 rval <<= 8;
208 rval |= *(*cpp)++;
209 return rval;
212 /* Decode a number */
213 long
214 decode(unsigned char **cpp)
216 register int x;
218 x = *(*cpp)++;
219 if(x == 0){
220 return pull16(cpp) & 0xffff; /* pull16 returns -1 on error */
221 } else {
222 return x & 0xff; /* -1 if PULLCHAR returned error */
227 * icp and isize are the original packet.
228 * ocp is a place to put a copy if necessary.
229 * cpp is initially a pointer to icp. If the copy is used,
230 * change it to ocp.
234 slhc_compress(struct slcompress *comp, unsigned char *icp, int isize,
235 unsigned char *ocp, unsigned char **cpp, int compress_cid)
237 register struct cstate *ocs = &(comp->tstate[comp->xmit_oldest]);
238 register struct cstate *lcs = ocs;
239 register struct cstate *cs = lcs->next;
240 register unsigned long deltaS, deltaA;
241 register short changes = 0;
242 int hlen;
243 unsigned char new_seq[16];
244 register unsigned char *cp = new_seq;
245 struct iphdr *ip;
246 struct tcphdr *th, *oth;
250 * Don't play with runt packets.
253 if(isize<sizeof(struct iphdr))
254 return isize;
256 ip = (struct iphdr *) icp;
258 /* Bail if this packet isn't TCP, or is an IP fragment */
259 if(ip->protocol != IPPROTO_TCP || (ntohs(ip->frag_off) & 0x1fff) ||
260 (ip->frag_off & 32)){
261 /* Send as regular IP */
262 if(ip->protocol != IPPROTO_TCP)
263 comp->sls_o_nontcp++;
264 else
265 comp->sls_o_tcp++;
266 return isize;
268 /* Extract TCP header */
270 th = (struct tcphdr *)(((unsigned char *)ip) + ip->ihl*4);
271 hlen = ip->ihl*4 + th->doff*4;
273 /* Bail if the TCP packet isn't `compressible' (i.e., ACK isn't set or
274 * some other control bit is set). Also uncompressible if
275 * its a runt.
277 if(hlen > isize || th->syn || th->fin || th->rst ||
278 ! (th->ack)){
279 /* TCP connection stuff; send as regular IP */
280 comp->sls_o_tcp++;
281 return isize;
284 * Packet is compressible -- we're going to send either a
285 * COMPRESSED_TCP or UNCOMPRESSED_TCP packet. Either way,
286 * we need to locate (or create) the connection state.
288 * States are kept in a circularly linked list with
289 * xmit_oldest pointing to the end of the list. The
290 * list is kept in lru order by moving a state to the
291 * head of the list whenever it is referenced. Since
292 * the list is short and, empirically, the connection
293 * we want is almost always near the front, we locate
294 * states via linear search. If we don't find a state
295 * for the datagram, the oldest state is (re-)used.
297 for ( ; ; ) {
298 if( ip->saddr == cs->cs_ip.saddr
299 && ip->daddr == cs->cs_ip.daddr
300 && th->source == cs->cs_tcp.source
301 && th->dest == cs->cs_tcp.dest)
302 goto found;
304 /* if current equal oldest, at end of list */
305 if ( cs == ocs )
306 break;
307 lcs = cs;
308 cs = cs->next;
309 comp->sls_o_searches++;
312 * Didn't find it -- re-use oldest cstate. Send an
313 * uncompressed packet that tells the other side what
314 * connection number we're using for this conversation.
316 * Note that since the state list is circular, the oldest
317 * state points to the newest and we only need to set
318 * xmit_oldest to update the lru linkage.
320 comp->sls_o_misses++;
321 comp->xmit_oldest = lcs->cs_this;
322 goto uncompressed;
324 found:
326 * Found it -- move to the front on the connection list.
328 if(lcs == ocs) {
329 /* found at most recently used */
330 } else if (cs == ocs) {
331 /* found at least recently used */
332 comp->xmit_oldest = lcs->cs_this;
333 } else {
334 /* more than 2 elements */
335 lcs->next = cs->next;
336 cs->next = ocs->next;
337 ocs->next = cs;
341 * Make sure that only what we expect to change changed.
342 * Check the following:
343 * IP protocol version, header length & type of service.
344 * The "Don't fragment" bit.
345 * The time-to-live field.
346 * The TCP header length.
347 * IP options, if any.
348 * TCP options, if any.
349 * If any of these things are different between the previous &
350 * current datagram, we send the current datagram `uncompressed'.
352 oth = &cs->cs_tcp;
354 if(last_retran
355 || ip->version != cs->cs_ip.version || ip->ihl != cs->cs_ip.ihl
356 || ip->tos != cs->cs_ip.tos
357 || (ip->frag_off & 64) != (cs->cs_ip.frag_off & 64)
358 || ip->ttl != cs->cs_ip.ttl
359 || th->doff != cs->cs_tcp.doff
360 || (ip->ihl > 5 && memcmp(ip+1,cs->cs_ipopt,((ip->ihl)-5)*4) != 0)
361 || (th->doff > 5 && memcmp(th+1,cs->cs_tcpopt,((th->doff)-5)*4) != 0)){
362 goto uncompressed;
366 * Figure out which of the changing fields changed. The
367 * receiver expects changes in the order: urgent, window,
368 * ack, seq (the order minimizes the number of temporaries
369 * needed in this section of code).
371 if(th->urg){
372 deltaS = ntohs(th->urg_ptr);
373 cp = encode(cp,deltaS);
374 changes |= NEW_U;
375 } else if(th->urg_ptr != oth->urg_ptr){
376 /* argh! URG not set but urp changed -- a sensible
377 * implementation should never do this but RFC793
378 * doesn't prohibit the change so we have to deal
379 * with it. */
380 goto uncompressed;
382 if((deltaS = ntohs(th->window) - ntohs(oth->window)) != 0){
383 cp = encode(cp,deltaS);
384 changes |= NEW_W;
386 if((deltaA = ntohl(th->ack_seq) - ntohl(oth->ack_seq)) != 0L){
387 if(deltaA > 0x0000ffff)
388 goto uncompressed;
389 cp = encode(cp,deltaA);
390 changes |= NEW_A;
392 if((deltaS = ntohl(th->seq) - ntohl(oth->seq)) != 0L){
393 if(deltaS > 0x0000ffff)
394 goto uncompressed;
395 cp = encode(cp,deltaS);
396 changes |= NEW_S;
399 switch(changes){
400 case 0: /* Nothing changed. If this packet contains data and the
401 * last one didn't, this is probably a data packet following
402 * an ack (normal on an interactive connection) and we send
403 * it compressed. Otherwise it's probably a retransmit,
404 * retransmitted ack or window probe. Send it uncompressed
405 * in case the other side missed the compressed version.
407 if(ip->tot_len != cs->cs_ip.tot_len &&
408 ntohs(cs->cs_ip.tot_len) == hlen)
409 break;
410 goto uncompressed;
411 break;
412 case SPECIAL_I:
413 case SPECIAL_D:
414 /* actual changes match one of our special case encodings --
415 * send packet uncompressed.
417 goto uncompressed;
418 case NEW_S|NEW_A:
419 if(deltaS == deltaA &&
420 deltaS == ntohs(cs->cs_ip.tot_len) - hlen){
421 /* special case for echoed terminal traffic */
422 changes = SPECIAL_I;
423 cp = new_seq;
425 break;
426 case NEW_S:
427 if(deltaS == ntohs(cs->cs_ip.tot_len) - hlen){
428 /* special case for data xfer */
429 changes = SPECIAL_D;
430 cp = new_seq;
432 break;
434 deltaS = ntohs(ip->id) - ntohs(cs->cs_ip.id);
435 if(deltaS != 1){
436 cp = encode(cp,deltaS);
437 changes |= NEW_I;
439 if(th->psh)
440 changes |= TCP_PUSH_BIT;
441 /* Grab the cksum before we overwrite it below. Then update our
442 * state with this packet's header.
444 deltaA = ntohs(th->check);
445 memcpy(&cs->cs_ip,ip,20);
446 memcpy(&cs->cs_tcp,th,20);
447 /* We want to use the original packet as our compressed packet.
448 * (cp - new_seq) is the number of bytes we need for compressed
449 * sequence numbers. In addition we need one byte for the change
450 * mask, one for the connection id and two for the tcp checksum.
451 * So, (cp - new_seq) + 4 bytes of header are needed.
453 deltaS = cp - new_seq;
454 if(compress_cid == 0 || comp->xmit_current != cs->cs_this){
455 cp = ocp;
456 *cpp = ocp;
457 *cp++ = changes | NEW_C;
458 *cp++ = cs->cs_this;
459 comp->xmit_current = cs->cs_this;
460 } else {
461 cp = ocp;
462 *cpp = ocp;
463 *cp++ = changes;
465 cp = put16(cp,(short)deltaA); /* Write TCP checksum */
466 /* deltaS is now the size of the change section of the compressed header */
467 memcpy(cp,new_seq,deltaS); /* Write list of deltas */
468 memcpy(cp+deltaS,icp+hlen,isize-hlen);
469 comp->sls_o_compressed++;
470 ocp[0] |= SL_TYPE_COMPRESSED_TCP;
471 return isize - hlen + deltaS + (cp - ocp);
473 /* Update connection state cs & send uncompressed packet (i.e.,
474 * a regular ip/tcp packet but with the 'conversation id' we hope
475 * to use on future compressed packets in the protocol field).
477 uncompressed:
478 memcpy(&cs->cs_ip,ip,20);
479 memcpy(&cs->cs_tcp,th,20);
480 if (ip->ihl > 5)
481 memcpy(cs->cs_ipopt, ip+1, ((ip->ihl) - 5) * 4);
482 if (th->doff > 5)
483 memcpy(cs->cs_tcpopt, th+1, ((th->doff) - 5) * 4);
484 comp->xmit_current = cs->cs_this;
485 comp->sls_o_uncompressed++;
486 memcpy(ocp, icp, isize);
487 *cpp = ocp;
488 ocp[9] = cs->cs_this;
489 ocp[0] |= SL_TYPE_UNCOMPRESSED_TCP;
490 return isize;
495 slhc_uncompress(struct slcompress *comp, unsigned char *icp, int isize)
497 register int changes;
498 long x;
499 register struct tcphdr *thp;
500 register struct iphdr *ip;
501 register struct cstate *cs;
502 int len, hdrlen;
503 unsigned char *cp = icp;
505 /* We've got a compressed packet; read the change byte */
506 comp->sls_i_compressed++;
507 if(isize < 3){
508 comp->sls_i_error++;
509 return 0;
511 changes = *cp++;
512 if(changes & NEW_C){
513 /* Make sure the state index is in range, then grab the state.
514 * If we have a good state index, clear the 'discard' flag.
516 x = *cp++; /* Read conn index */
517 if(x < 0 || x > comp->rslot_limit)
518 goto bad;
520 comp->flags &=~ SLF_TOSS;
521 comp->recv_current = x;
522 } else {
523 /* this packet has an implicit state index. If we've
524 * had a line error since the last time we got an
525 * explicit state index, we have to toss the packet. */
526 if(comp->flags & SLF_TOSS){
527 comp->sls_i_tossed++;
528 return 0;
531 cs = &comp->rstate[comp->recv_current];
532 thp = &cs->cs_tcp;
533 ip = &cs->cs_ip;
535 if((x = pull16(&cp)) == -1) { /* Read the TCP checksum */
536 goto bad;
538 thp->check = htons(x);
540 thp->psh = (changes & TCP_PUSH_BIT) ? 1 : 0;
542 * we can use the same number for the length of the saved header and
543 * the current one, because the packet wouldn't have been sent
544 * as compressed unless the options were the same as the previous one
547 hdrlen = ip->ihl * 4 + thp->doff * 4;
549 switch(changes & SPECIALS_MASK){
550 case SPECIAL_I: /* Echoed terminal traffic */
552 register short i;
553 i = ntohs(ip->tot_len) - hdrlen;
554 thp->ack_seq = htonl( ntohl(thp->ack_seq) + i);
555 thp->seq = htonl( ntohl(thp->seq) + i);
557 break;
559 case SPECIAL_D: /* Unidirectional data */
560 thp->seq = htonl( ntohl(thp->seq) +
561 ntohs(ip->tot_len) - hdrlen);
562 break;
564 default:
565 if(changes & NEW_U){
566 thp->urg = 1;
567 if((x = decode(&cp)) == -1) {
568 goto bad;
570 thp->urg_ptr = htons(x);
571 } else
572 thp->urg = 0;
573 if(changes & NEW_W){
574 if((x = decode(&cp)) == -1) {
575 goto bad;
577 thp->window = htons( ntohs(thp->window) + x);
579 if(changes & NEW_A){
580 if((x = decode(&cp)) == -1) {
581 goto bad;
583 thp->ack_seq = htonl( ntohl(thp->ack_seq) + x);
585 if(changes & NEW_S){
586 if((x = decode(&cp)) == -1) {
587 goto bad;
589 thp->seq = htonl( ntohl(thp->seq) + x);
591 break;
593 if(changes & NEW_I){
594 if((x = decode(&cp)) == -1) {
595 goto bad;
597 ip->id = htons (ntohs (ip->id) + x);
598 } else
599 ip->id = htons (ntohs (ip->id) + 1);
602 * At this point, cp points to the first byte of data in the
603 * packet. Put the reconstructed TCP and IP headers back on the
604 * packet. Recalculate IP checksum (but not TCP checksum).
607 len = isize - (cp - icp);
608 if (len < 0)
609 goto bad;
610 len += hdrlen;
611 ip->tot_len = htons(len);
612 ip->check = 0;
614 memmove(icp + hdrlen, cp, len - hdrlen);
616 cp = icp;
617 memcpy(cp, ip, 20);
618 cp += 20;
620 if (ip->ihl > 5) {
621 memcpy(cp, cs->cs_ipopt, (ip->ihl - 5) * 4);
622 cp += (ip->ihl - 5) * 4;
625 put_unaligned(ip_fast_csum(icp, ip->ihl),
626 &((struct iphdr *)icp)->check);
628 memcpy(cp, thp, 20);
629 cp += 20;
631 if (thp->doff > 5) {
632 memcpy(cp, cs->cs_tcpopt, ((thp->doff) - 5) * 4);
633 cp += ((thp->doff) - 5) * 4;
636 return len;
637 bad:
638 comp->sls_i_error++;
639 return slhc_toss( comp );
644 slhc_remember(struct slcompress *comp, unsigned char *icp, int isize)
646 register struct cstate *cs;
647 unsigned ihl;
649 unsigned char index;
651 if(isize < 20) {
652 /* The packet is shorter than a legal IP header */
653 comp->sls_i_runt++;
654 return slhc_toss( comp );
656 /* Peek at the IP header's IHL field to find its length */
657 ihl = icp[0] & 0xf;
658 if(ihl < 20 / 4){
659 /* The IP header length field is too small */
660 comp->sls_i_runt++;
661 return slhc_toss( comp );
663 index = icp[9];
664 icp[9] = IPPROTO_TCP;
666 if (ip_fast_csum(icp, ihl)) {
667 /* Bad IP header checksum; discard */
668 comp->sls_i_badcheck++;
669 return slhc_toss( comp );
671 if(index > comp->rslot_limit) {
672 comp->sls_i_error++;
673 return slhc_toss(comp);
676 /* Update local state */
677 cs = &comp->rstate[comp->recv_current = index];
678 comp->flags &=~ SLF_TOSS;
679 memcpy(&cs->cs_ip,icp,20);
680 memcpy(&cs->cs_tcp,icp + ihl*4,20);
681 if (ihl > 5)
682 memcpy(cs->cs_ipopt, icp + sizeof(struct iphdr), (ihl - 5) * 4);
683 if (cs->cs_tcp.doff > 5)
684 memcpy(cs->cs_tcpopt, icp + ihl*4 + sizeof(struct tcphdr), (cs->cs_tcp.doff - 5) * 4);
685 cs->cs_hsize = ihl*2 + cs->cs_tcp.doff*2;
686 /* Put headers back on packet
687 * Neither header checksum is recalculated
689 comp->sls_i_uncompressed++;
690 return isize;
695 slhc_toss(struct slcompress *comp)
697 if ( comp == NULLSLCOMPR )
698 return 0;
700 comp->flags |= SLF_TOSS;
701 return 0;
705 void slhc_i_status(struct slcompress *comp)
707 if (comp != NULLSLCOMPR) {
708 printk("\t%d Cmp, %d Uncmp, %d Bad, %d Tossed\n",
709 comp->sls_i_compressed,
710 comp->sls_i_uncompressed,
711 comp->sls_i_error,
712 comp->sls_i_tossed);
717 void slhc_o_status(struct slcompress *comp)
719 if (comp != NULLSLCOMPR) {
720 printk("\t%d Cmp, %d Uncmp, %d AsIs, %d NotTCP\n",
721 comp->sls_o_compressed,
722 comp->sls_o_uncompressed,
723 comp->sls_o_tcp,
724 comp->sls_o_nontcp);
725 printk("\t%10d Searches, %10d Misses\n",
726 comp->sls_o_searches,
727 comp->sls_o_misses);
731 /* Should this be surrounded with "#ifdef CONFIG_MODULES" ? */
732 /* VJ header compression */
733 EXPORT_SYMBOL(slhc_init);
734 EXPORT_SYMBOL(slhc_free);
735 EXPORT_SYMBOL(slhc_remember);
736 EXPORT_SYMBOL(slhc_compress);
737 EXPORT_SYMBOL(slhc_uncompress);
738 EXPORT_SYMBOL(slhc_toss);
740 #ifdef MODULE
742 int init_module(void)
744 printk(KERN_INFO "CSLIP: code copyright 1989 Regents of the University of California\n");
745 return 0;
748 void cleanup_module(void)
750 return;
753 #endif /* MODULE */
754 #else /* CONFIG_INET */
758 slhc_toss(struct slcompress *comp)
760 printk(KERN_DEBUG "Called IP function on non IP-system: slhc_toss");
761 return -EINVAL;
764 slhc_uncompress(struct slcompress *comp, unsigned char *icp, int isize)
766 printk(KERN_DEBUG "Called IP function on non IP-system: slhc_uncompress");
767 return -EINVAL;
770 slhc_compress(struct slcompress *comp, unsigned char *icp, int isize,
771 unsigned char *ocp, unsigned char **cpp, int compress_cid)
773 printk(KERN_DEBUG "Called IP function on non IP-system: slhc_compress");
774 return -EINVAL;
778 slhc_remember(struct slcompress *comp, unsigned char *icp, int isize)
780 printk(KERN_DEBUG "Called IP function on non IP-system: slhc_remember");
781 return -EINVAL;
784 void
785 slhc_free(struct slcompress *comp)
787 printk(KERN_DEBUG "Called IP function on non IP-system: slhc_free");
788 return;
790 struct slcompress *
791 slhc_init(int rslots, int tslots)
793 printk(KERN_DEBUG "Called IP function on non IP-system: slhc_init");
794 return NULL;
796 EXPORT_SYMBOL(slhc_init);
797 EXPORT_SYMBOL(slhc_free);
798 EXPORT_SYMBOL(slhc_remember);
799 EXPORT_SYMBOL(slhc_compress);
800 EXPORT_SYMBOL(slhc_uncompress);
801 EXPORT_SYMBOL(slhc_toss);
803 #endif /* CONFIG_INET */