kerneldefs.pp 20 KB

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