1{$mode objfpc}
2{$h+}
3
4{$if not defined(linux) or not defined(cpui386)}
5  {$error The KernelDefs unit is a legacy Kylix-compatibility unit that is only supported on Linux/i386. It is known not to work in various ways on other OSes and architectures (including Linux/x86_64). }
6{$endif}
7
8unit kerneldefs;
9
10interface
11// Translated from asm/types.h (i386)
12
13const
14   HZ = 100;
15   EXEC_PAGESIZE = 4096;
16   NGROUPS = 32;
17   NOGROUP = -(1);
18   MAXHOSTNAMELEN = 64;
19   CLOCKS_PER_SEC = 100;
20type
21   Pumode_t = ^umode_t;
22   umode_t = word;
23
24   P__s8 = ^__s8;
25   __s8 = shortint;
26
27   P__u8 = ^__u8;
28   __u8 = byte;
29
30   P__s16 = ^__s16;
31   __s16 = smallint;
32
33   P__u16 = ^__u16;
34   __u16 = word;
35
36   P__s32 = ^__s32;
37   __s32 = longint;
38
39   P__u32 = ^__u32;
40   __u32 = dword;
41
42   P__s64 = ^__s64;
43   __s64 = int64;
44
45   P__u64 = ^__u64;
46   __u64 = qword;
47
48type
49
50   Ps8 = ^s8;
51   s8 = char;
52
53   Pu8 = ^u8;
54   u8 = byte;
55
56   Ps16 = ^s16;
57   s16 = smallint;
58
59   Pu16 = ^u16;
60   u16 = word;
61
62   Ps32 = ^s32;
63   s32 = longint;
64
65   Pu32 = ^u32;
66   u32 = dword;
67
68   Ps64 = ^s64;
69   s64 = int64;
70
71   Pu64 = ^u64;
72   u64 = qword;
73
74const
75   BITS_PER_LONG = 32;
76
77// Translated from include/linux/if_ether.h
78
79
80const
81   ETH_ALEN = 6;
82   ETH_HLEN = 14;
83   ETH_ZLEN = 60;
84   ETH_DATA_LEN = 1500;
85   ETH_FRAME_LEN = 1514;
86   ETH_P_LOOP = $0060;
87   ETH_P_PUP = $0200;
88   ETH_P_PUPAT = $0201;
89   ETH_P_IP = $0800;
90   ETH_P_X25 = $0805;
91   ETH_P_ARP = $0806;
92   ETH_P_BPQ = $08FF;
93   ETH_P_IEEEPUP = $0a00;
94   ETH_P_IEEEPUPAT = $0a01;
95   ETH_P_DEC = $6000;
96   ETH_P_DNA_DL = $6001;
97   ETH_P_DNA_RC = $6002;
98   ETH_P_DNA_RT = $6003;
99   ETH_P_LAT = $6004;
100   ETH_P_DIAG = $6005;
101   ETH_P_CUST = $6006;
102   ETH_P_SCA = $6007;
103   ETH_P_RARP = $8035;
104   ETH_P_ATALK = $809B;
105   ETH_P_AARP = $80F3;
106   ETH_P_8021Q = $8100;
107   ETH_P_IPX = $8137;
108   ETH_P_IPV6 = $86DD;
109   ETH_P_PPP_DISC = $8863;
110   ETH_P_PPP_SES = $8864;
111   ETH_P_ATMMPOA = $884c;
112   ETH_P_ATMFATE = $8884;
113   ETH_P_802_3 = $0001;
114   ETH_P_AX25 = $0002;
115   ETH_P_ALL = $0003;
116   ETH_P_802_2 = $0004;
117   ETH_P_SNAP = $0005;
118   ETH_P_DDCMP = $0006;
119   ETH_P_WAN_PPP = $0007;
120   ETH_P_PPP_MP = $0008;
121   ETH_P_LOCALTALK = $0009;
122   ETH_P_PPPTALK = $0010;
123   ETH_P_TR_802_2 = $0011;
124   ETH_P_MOBITEX = $0015;
125   ETH_P_CONTROL = $0016;
126   ETH_P_IRDA = $0017;
127   ETH_P_ECONET = $0018;
128type
129   Pethhdr = ^ethhdr;
130   ethhdr = record
131        h_dest : array[0..(ETH_ALEN)-1] of byte;
132        h_source : array[0..(ETH_ALEN)-1] of byte;
133        h_proto : word;
134     end;
135
136// Translated from include/linux/if_fddi.h
137
138
139const
140   FDDI_K_ALEN = 6;
141   FDDI_K_8022_HLEN = 16;
142   FDDI_K_SNAP_HLEN = 21;
143   FDDI_K_8022_ZLEN = 16;
144   FDDI_K_SNAP_ZLEN = 21;
145   FDDI_K_8022_DLEN = 4475;
146   FDDI_K_SNAP_DLEN = 4470;
147   FDDI_K_LLC_ZLEN = 13;
148   FDDI_K_LLC_LEN = 4491;
149   FDDI_FC_K_VOID = $00;
150   FDDI_FC_K_NON_RESTRICTED_TOKEN = $80;
151   FDDI_FC_K_RESTRICTED_TOKEN = $C0;
152   FDDI_FC_K_SMT_MIN = $41;
153   FDDI_FC_K_SMT_MAX = $4F;
154   FDDI_FC_K_MAC_MIN = $C1;
155   FDDI_FC_K_MAC_MAX = $CF;
156   FDDI_FC_K_ASYNC_LLC_MIN = $50;
157   FDDI_FC_K_ASYNC_LLC_DEF = $54;
158   FDDI_FC_K_ASYNC_LLC_MAX = $5F;
159   FDDI_FC_K_SYNC_LLC_MIN = $D0;
160   FDDI_FC_K_SYNC_LLC_MAX = $D7;
161   FDDI_FC_K_IMPLEMENTOR_MIN = $60;
162   FDDI_FC_K_IMPLEMENTOR_MAX = $6F;
163   FDDI_FC_K_RESERVED_MIN = $70;
164   FDDI_FC_K_RESERVED_MAX = $7F;
165   FDDI_EXTENDED_SAP = $AA;
166   FDDI_UI_CMD = $03;
167
168type
169   Pfddi_8022_1_hdr = ^fddi_8022_1_hdr;
170   fddi_8022_1_hdr = record
171        dsap : __u8;
172        ssap : __u8;
173        ctrl : __u8;
174     end;
175
176   Pfddi_8022_2_hdr = ^fddi_8022_2_hdr;
177   fddi_8022_2_hdr = record
178        dsap : __u8;
179        ssap : __u8;
180        ctrl_1 : __u8;
181        ctrl_2 : __u8;
182     end;
183
184
185const
186   FDDI_K_OUI_LEN = 3;
187type
188   Pfddi_snap_hdr = ^fddi_snap_hdr;
189   fddi_snap_hdr = record
190        dsap : __u8;
191        ssap : __u8;
192        ctrl : __u8;
193        oui : array[0..(FDDI_K_OUI_LEN)-1] of __u8;
194        ethertype : __u16;
195     end;
196
197   Pfddihdr = ^fddihdr;
198   fddihdr = record
199        fc : __u8;
200        daddr : array[0..(FDDI_K_ALEN)-1] of __u8;
201        saddr : array[0..(FDDI_K_ALEN)-1] of __u8;
202        hdr : record
203            case longint of
204               0 : ( llc_8022_1 : fddi_8022_1_hdr );
205               1 : ( llc_8022_2 : fddi_8022_2_hdr );
206               2 : ( llc_snap : fddi_snap_hdr );
207            end;
208     end;
209
210   Pfddi_statistics = ^fddi_statistics;
211   fddi_statistics = record
212        rx_packets : __u32;
213        tx_packets : __u32;
214        rx_bytes : __u32;
215        tx_bytes : __u32;
216        rx_errors : __u32;
217        tx_errors : __u32;
218        rx_dropped : __u32;
219        tx_dropped : __u32;
220        multicast : __u32;
221        transmit_collision : __u32;
222        rx_length_errors : __u32;
223        rx_over_errors : __u32;
224        rx_crc_errors : __u32;
225        rx_frame_errors : __u32;
226        rx_fifo_errors : __u32;
227        rx_missed_errors : __u32;
228        tx_aborted_errors : __u32;
229        tx_carrier_errors : __u32;
230        tx_fifo_errors : __u32;
231        tx_heartbeat_errors : __u32;
232        tx_window_errors : __u32;
233        rx_compressed : __u32;
234        tx_compressed : __u32;
235        smt_station_id : array[0..7] of __u8;
236        smt_op_version_id : __u32;
237        smt_hi_version_id : __u32;
238        smt_lo_version_id : __u32;
239        smt_user_data : array[0..31] of __u8;
240        smt_mib_version_id : __u32;
241        smt_mac_cts : __u32;
242        smt_non_master_cts : __u32;
243        smt_master_cts : __u32;
244        smt_available_paths : __u32;
245        smt_config_capabilities : __u32;
246        smt_config_policy : __u32;
247        smt_connection_policy : __u32;
248        smt_t_notify : __u32;
249        smt_stat_rpt_policy : __u32;
250        smt_trace_max_expiration : __u32;
251        smt_bypass_present : __u32;
252        smt_ecm_state : __u32;
253        smt_cf_state : __u32;
254        smt_remote_disconnect_flag : __u32;
255        smt_station_status : __u32;
256        smt_peer_wrap_flag : __u32;
257        smt_time_stamp : __u32;
258        smt_transition_time_stamp : __u32;
259        mac_frame_status_Functions : __u32;
260        mac_t_max_capability : __u32;
261        mac_tvx_capability : __u32;
262        mac_available_paths : __u32;
263        mac_current_path : __u32;
264        mac_upstream_nbr : array[0..(FDDI_K_ALEN)-1] of __u8;
265        mac_downstream_nbr : array[0..(FDDI_K_ALEN)-1] of __u8;
266        mac_old_upstream_nbr : array[0..(FDDI_K_ALEN)-1] of __u8;
267        mac_old_downstream_nbr : array[0..(FDDI_K_ALEN)-1] of __u8;
268        mac_dup_address_test : __u32;
269        mac_requested_paths : __u32;
270        mac_downstream_port_type : __u32;
271        mac_smt_address : array[0..(FDDI_K_ALEN)-1] of __u8;
272        mac_t_req : __u32;
273        mac_t_neg : __u32;
274        mac_t_max : __u32;
275        mac_tvx_value : __u32;
276        mac_frame_cts : __u32;
277        mac_copied_cts : __u32;
278        mac_transmit_cts : __u32;
279        mac_error_cts : __u32;
280        mac_lost_cts : __u32;
281        mac_frame_error_threshold : __u32;
282        mac_frame_error_ratio : __u32;
283        mac_rmt_state : __u32;
284        mac_da_flag : __u32;
285        mac_una_da_flag : __u32;
286        mac_frame_error_flag : __u32;
287        mac_ma_unitdata_available : __u32;
288        mac_hardware_present : __u32;
289        mac_ma_unitdata_enable : __u32;
290        path_tvx_lower_bound : __u32;
291        path_t_max_lower_bound : __u32;
292        path_max_t_req : __u32;
293        path_configuration : array[0..7] of __u32;
294        port_my_type : array[0..1] of __u32;
295        port_neighbor_type : array[0..1] of __u32;
296        port_connection_policies : array[0..1] of __u32;
297        port_mac_indicated : array[0..1] of __u32;
298        port_current_path : array[0..1] of __u32;
299        port_requested_paths : array[0..(3 * 2)-1] of __u8;
300        port_mac_placement : array[0..1] of __u32;
301        port_available_paths : array[0..1] of __u32;
302        port_pmd_class : array[0..1] of __u32;
303        port_connection_capabilities : array[0..1] of __u32;
304        port_bs_flag : array[0..1] of __u32;
305        port_lct_fail_cts : array[0..1] of __u32;
306        port_ler_estimate : array[0..1] of __u32;
307        port_lem_reject_cts : array[0..1] of __u32;
308        port_lem_cts : array[0..1] of __u32;
309        port_ler_cutoff : array[0..1] of __u32;
310        port_ler_alarm : array[0..1] of __u32;
311        port_connect_state : array[0..1] of __u32;
312        port_pcm_state : array[0..1] of __u32;
313        port_pc_withhold : array[0..1] of __u32;
314        port_ler_flag : array[0..1] of __u32;
315        port_hardware_present : array[0..1] of __u32;
316     end;
317
318// Translated from /linux/if_slip.h
319
320
321const
322   SL_MODE_SLIP = 0;
323   SL_MODE_CSLIP = 1;
324   SL_MODE_KISS = 4;
325   SL_OPT_SIXBIT = 2;
326   SL_OPT_ADAPTIVE = 8;
327
328   SIOCDEVPRIVATE       = $89F0;
329   SIOCPROTOPRIVATE     = $89E0;
330
331   SIOCSKEEPALIVE = SIOCDEVPRIVATE;
332   SIOCGKEEPALIVE = SIOCDEVPRIVATE + 1;
333   SIOCSOUTFILL = SIOCDEVPRIVATE + 2;
334   SIOCGOUTFILL = SIOCDEVPRIVATE + 3;
335   SIOCSLEASE = SIOCDEVPRIVATE + 4;
336   SIOCGLEASE = SIOCDEVPRIVATE + 5;
337
338// Translated from /linux/if_tr.h
339
340
341const
342   TR_ALEN = 6;
343   AC = $10;
344   LLC_FRAME = $40;
345
346    EXTENDED_SAP = $AA;
347    UI_CMD = $03;
348
349
350type
351       Ptrh_hdr = ^trh_hdr;
352       trh_hdr = record
353            ac : __u8;
354            fc : __u8;
355            daddr : array[0..(TR_ALEN)-1] of __u8;
356            saddr : array[0..(TR_ALEN)-1] of __u8;
357            rcf : __u16;
358            rseg : array[0..7] of __u16;
359         end;
360
361       Ptrllc = ^trllc;
362       trllc = record
363            dsap : __u8;
364            ssap : __u8;
365            llc : __u8;
366            protid : array[0..2] of __u8;
367            ethertype : __u16;
368         end;
369
370       Ptr_statistics = ^tr_statistics;
371       tr_statistics = record
372            rx_packets : dword;
373            tx_packets : dword;
374            rx_bytes : dword;
375            tx_bytes : dword;
376            rx_errors : dword;
377            tx_errors : dword;
378            rx_dropped : dword;
379            tx_dropped : dword;
380            multicast : dword;
381            transmit_collision : dword;
382            line_errors : dword;
383            internal_errors : dword;
384            burst_errors : dword;
385            A_C_errors : dword;
386            abort_delimiters : dword;
387            lost_frames : dword;
388            recv_congest_count : dword;
389            frame_copied_errors : dword;
390            frequency_errors : dword;
391            token_errors : dword;
392            dummy1 : dword;
393         end;
394
395
396    const
397       TR_RII = $80;
398       TR_RCF_DIR_BIT = $80;
399       TR_RCF_LEN_MASK = $1f00;
400       TR_RCF_BROADCAST = $8000;
401       TR_RCF_LIMITED_BROADCAST = $C000;
402       TR_RCF_FRAME2K = $20;
403       TR_RCF_BROADCAST_MASK = $C000;
404       TR_MAXRIFLEN = 18;
405
406const
407  TR_HLEN      = (SizeOf(trh_hdr) + SizeOf(trllc));
408
409// Translated from linux/ppp_defs.h
410
411    const
412       PPP_HDRLEN = 4;
413       PPP_FCSLEN = 2;
414       PPP_MRU = 1500;
415
416Function PPP_ADDRESS(const p): __u8;
417Function PPP_CONTROL(const p): __u8;
418Function PPP_PROTOCOL(const p): __u16;
419
420
421Const
422       PPP_ALLSTATIONS = $ff;
423       PPP_UI = $03;
424       PPP_FLAG = $7e;
425       PPP_ESCAPE = $7d;
426       PPP_TRANS = $20;
427       PPP_IP = $21;
428       PPP_AT = $29;
429       PPP_IPX = $2b;
430       PPP_VJC_COMP = $2d;
431       PPP_VJC_UNCOMP = $2f;
432       PPP_MP = $3d;
433       PPP_IPV6 = $57;
434       PPP_COMPFRAG = $fb;
435       PPP_COMP = $fd;
436       PPP_IPCP = $8021;
437       PPP_ATCP = $8029;
438       PPP_IPXCP = $802b;
439       PPP_IPV6CP = $8057;
440       PPP_CCPFRAG = $80fb;
441       PPP_CCP = $80fd;
442       PPP_LCP = $c021;
443       PPP_PAP = $c023;
444       PPP_LQR = $c025;
445       PPP_CHAP = $c223;
446       PPP_CBCP = $c029;
447       PPP_INITFCS = $ffff;
448       PPP_GOODFCS = $f0b8;
449
450    type
451
452       Pext_accm = ^ext_accm;
453       ext_accm = packed array[0..8-1] of __u32;
454
455       NPmode =  Longint;
456       Const
457         NPMODE_PASS = 0;
458         NPMODE_DROP = 1;
459         NPMODE_ERROR = 2;
460         NPMODE_QUEUE = 3;
461
462    type
463       Ppppstat = ^pppstat;
464       pppstat = record
465            ppp_discards : __u32;
466            ppp_ibytes : __u32;
467            ppp_ioctects : __u32;
468            ppp_ipackets : __u32;
469            ppp_ierrors : __u32;
470            ppp_ilqrs : __u32;
471            ppp_obytes : __u32;
472            ppp_ooctects : __u32;
473            ppp_opackets : __u32;
474            ppp_oerrors : __u32;
475            ppp_olqrs : __u32;
476         end;
477
478       Pvjstat = ^vjstat;
479       vjstat = record
480            vjs_packets : __u32;
481            vjs_compressed : __u32;
482            vjs_searches : __u32;
483            vjs_misses : __u32;
484            vjs_uncompressedin : __u32;
485            vjs_compressedin : __u32;
486            vjs_errorin : __u32;
487            vjs_tossed : __u32;
488         end;
489
490       Pcompstat = ^compstat;
491       compstat = record
492            unc_bytes : __u32;
493            unc_packets : __u32;
494            comp_bytes : __u32;
495            comp_packets : __u32;
496            inc_bytes : __u32;
497            inc_packets : __u32;
498            in_count : __u32;
499            bytes_out : __u32;
500            ratio : double;
501         end;
502
503       Pppp_stats = ^ppp_stats;
504       ppp_stats = record
505            p : pppstat;
506            vj : vjstat;
507         end;
508
509       Pppp_comp_stats = ^ppp_comp_stats;
510       ppp_comp_stats = record
511            c : compstat;
512            d : compstat;
513         end;
514
515      __kernel_time_t = Longint;
516      ppp_idle = record
517          xmit_idle: __kernel_time_t;
518          recv_idle: __kernel_time_t;
519      end;
520      Pppp_idle = ^ppp_idle;
521
522// Translated from linux/ppp-comp.h
523
524    const
525       DO_BSD_COMPRESS = 1;
526       DO_DEFLATE = 1;
527       DO_PREDICTOR_1 = 0;
528       DO_PREDICTOR_2 = 0;
529
530    type
531       Pcompressor = ^compressor;
532       compressor = record
533            compress_proto : longint;
534            comp_alloc : Function (options:Pbyte; opt_len:longint):pointer;cdecl;
535            comp_free : procedure (state:pointer);
536            comp_init : Function (state:pointer; options:Pbyte; opt_len:longint; _unit:longint; opthdr:longint;
537                         debug:longint):longint;
538            comp_reset : procedure (state:pointer);
539            compress : Function (state:pointer; rptr:Pbyte; obuf:Pbyte; isize:longint; osize:longint):longint;
540            comp_stat : procedure (state:pointer; stats:Pcompstat);
541            decomp_alloc : Function (options:Pbyte; opt_len:longint):pointer;
542            decomp_free : procedure (state:pointer);
543            decomp_init : Function (state:pointer; options:Pbyte; opt_len:longint; _unit:longint; opthdr:longint;
544                         mru:longint; debug:longint):longint;
545            decomp_reset : procedure (state:pointer);
546            decompress : Function (state:pointer; ibuf:Pbyte; isize:longint; obuf:Pbyte; osize:longint):longint;
547            incomp : procedure (state:pointer; ibuf:Pbyte; icnt:longint);
548            decomp_stat : procedure (state:pointer; stats:Pcompstat);
549         end;
550
551
552    const
553       DECOMP_ERROR = -(1);
554       DECOMP_FATALERROR = -(2);
555       CCP_CONFREQ = 1;
556       CCP_CONFACK = 2;
557       CCP_TERMREQ = 5;
558       CCP_TERMACK = 6;
559       CCP_RESETREQ = 14;
560       CCP_RESETACK = 15;
561       CCP_MAX_OPTION_LENGTH = 32;
562
563
564Function CCP_CODE(dp: Pointer): Byte;
565Function CCP_ID(dp: Pointer): Byte;
566Function CCP_LENGTH(dp: Pointer): Word;
567Function CCP_OPT_CODE(dp: Pointer): Byte;
568Function CCP_OPT_LENGTH(dp: Pointer): Byte;
569
570const
571       CCP_HDRLEN      = 4;
572       CCP_OPT_MINLEN = 2;
573       CI_BSD_COMPRESS = 21;
574       CILEN_BSD_COMPRESS = 3;
575       BSD_CURRENT_VERSION = 1;
576
577Function BSD_NBITS(x: longint): longint;
578Function BSD_VERSION(x: longint): longint;
579Function BSD_MAKE_OPT(v, n: longint): longint;
580
581    const
582       BSD_MIN_BITS = 9;
583       BSD_MAX_BITS = 15;
584       CI_DEFLATE = 26;
585       CI_DEFLATE_DRAFT = 24;
586       CILEN_DEFLATE = 4;
587       DEFLATE_MIN_SIZE = 8;
588       DEFLATE_MAX_SIZE = 15;
589       DEFLATE_METHOD_VAL = 8;
590
591Function DEFLATE_SIZE(x: longint): longint;
592Function DEFLATE_METHOD(x: longint): longint;
593Function DEFLATE_MAKE_OPT(w: longint): longint;
594
595    const
596       DEFLATE_CHK_SEQUENCE = 0;
597       CI_PREDICTOR_1 = 1;
598       CILEN_PREDICTOR_1 = 2;
599       CI_PREDICTOR_2 = 2;
600       CILEN_PREDICTOR_2 = 2;
601
602// Translated from linux/atalk.h
603
604    const
605       ATPORT_FIRST = 1;
606       ATPORT_RESERVED = 128;
607       ATPORT_LAST = 254;
608       ATADDR_ANYNET = __u16(0);
609       ATADDR_ANYNODE = __u8(0);
610       ATADDR_ANYPORT = __u8(0);
611       ATADDR_BCAST = __u8(255);
612
613    const
614       DDP_MAXSZ = 587;
615       DDP_MAXHOPS = 15;
616       SIOCATALKDIFADDR = SIOCPROTOPRIVATE + 0;
617    type
618       Pat_addr = ^at_addr;
619       at_addr = record
620            s_net : __u16;
621            s_node : __u8;
622         end;
623
624       sa_family_t = Word; // From libc.
625
626       Psockaddr_at = ^sockaddr_at;
627       sockaddr_at = record
628            sat_family : sa_family_t;
629            sat_port : __u8;
630            sat_addr : at_addr;
631            sat_zero : array[0..7] of char;
632         end;
633
634       Pnetrange = ^netrange;
635       netrange = record
636            nr_phase : __u8;
637            nr_firstnet : __u16;
638            nr_lastnet : __u16;
639         end;
640
641       Patalk_route = ^atalk_route;
642       atalk_route = record
643            dev : Pointer; // pnet_device ??
644            target : at_addr;
645            gateway : at_addr;
646            flags : longint;
647            next : Patalk_route;
648         end;
649
650Const
651  ATIF_PROBE      = 1;    { Probing for an address }
652  ATIF_PROBE_FAIL = 2;    { Probe collided }
653
654Type
655       PATalkIFace = ^TATalkIFace;
656       atalk_iface = record
657           dev: Pointer;
658           address: at_addr;
659           status: longint;
660           nets: netrange;
661           next: PATalkIFace;
662       end;
663      TATalkIFace = atalk_iface;
664
665
666       Patalk_sock = ^atalk_sock;
667       atalk_sock = record
668            dest_net : word;
669            src_net : word;
670            dest_node : byte;
671            src_node : byte;
672            dest_port : byte;
673            src_port : byte;
674         end;
675
676// Translated from linux/igmp.h
677
678    type
679       Pigmphdr = ^igmphdr;
680       igmphdr = record
681            __type : __u8;
682            code : __u8;
683            csum : __u16;
684            group : __u32;
685         end;
686
687
688    const
689       IGMP_HOST_MEMBERSHIP_QUERY = $11;
690       IGMP_HOST_MEMBERSHIP_REPORT = $12;
691       IGMP_DVMRP = $13;
692       IGMP_PIM = $14;
693       IGMP_TRACE = $15;
694       IGMP_HOST_NEW_MEMBERSHIP_REPORT = $16;
695       IGMP_HOST_LEAVE_MESSAGE = $17;
696       IGMP_MTRACE_RESP = $1e;
697       IGMP_MTRACE = $1f;
698       IGMP_DELAYING_MEMBER = $01;
699       IGMP_IDLE_MEMBER = $02;
700       IGMP_LAZY_MEMBER = $03;
701       IGMP_SLEEPING_MEMBER = $04;
702       IGMP_AWAKENING_MEMBER = $05;
703       IGMP_MINLEN = 8;
704       IGMP_MAX_HOST_REPORT_DELAY = 10;
705       IGMP_TIMER_SCALE = 10;
706       IGMP_AGE_THRESHOLD = 400;
707
708{ ---------------------------------------------------------------------
709    Borland compatibility types
710  ---------------------------------------------------------------------}
711
712Type
713  TATalkRoute = atalk_route;
714
715Implementation
716
717Function PPP_ADDRESS(const p): __u8;
718
719begin
720  Result:=P__u8(@p)^;
721end;
722
723Function PPP_CONTROL(const p): __u8;
724begin
725  Result:=P__u8(Cardinal(@p) + SizeOf(__u8))^;
726end;
727
728Function PPP_PROTOCOL(const p): __u16;
729begin
730  Result:=P__u8(Cardinal(@p) + SizeOf(__u8)*2)^ shl 8;
731  Result:=Result + P__u8(Cardinal(@p) + SizeOf(__u8)*3)^
732end;
733
734Function CCP_CODE(dp: Pointer): Byte;
735begin
736  Result:=PByte(dp)^;
737end;
738
739Function CCP_ID(dp: Pointer): Byte;
740begin
741  Inc(PByte(dp));
742  Result:=PByte(dp)^;
743end;
744
745Function CCP_LENGTH(dp: Pointer): Word;
746begin
747  Inc(PByte(dp), 2);
748  Result:=(PByte(dp)^ shl 8);
749  Inc(PByte(dp), 1);
750  Result:=Result + PByte(dp)^;
751end;
752
753Function CCP_OPT_CODE(dp: Pointer): Byte;
754begin
755  Result:=PByte(dp)^;
756end;
757
758Function CCP_OPT_LENGTH(dp: Pointer): Byte;
759begin
760  Inc(PByte(dp));
761  Result:=PByte(dp)^;
762end;
763
764Function DEFLATE_SIZE(x: longint): longint;
765begin
766  Result:=(Cardinal(x) shr 4) + DEFLATE_MIN_SIZE;
767end;
768
769Function DEFLATE_METHOD(x: longint): longint;
770begin
771  Result:=x and $0F;
772end;
773
774Function DEFLATE_MAKE_OPT(w: longint): longint;
775begin
776  Result:=((w - DEFLATE_MIN_SIZE) shl 4) + DEFLATE_METHOD_VAL;
777end;
778
779Function BSD_NBITS(x: longint): longint;
780begin
781  Result:=(x and $1F);
782end;
783
784Function BSD_VERSION(x: longint): longint;
785begin
786  Result:=Cardinal(x) shr 5;
787end;
788
789Function BSD_MAKE_OPT(v, n: longint): longint;
790begin
791  Result:= longint((Cardinal(v) shl 5) or Cardinal(n));
792end;
793
794end.
795