+ struct x25_ifaddr *pk_ia; /* backpointer to ifaddr */
+ struct pklcd **pk_chan; /* actual size == xc_maxlcn+1 */
+ short pk_dxerole; /* DXE role of PLE over LLC2 */
+ short pk_restartcolls; /* counting RESTART collisions til resolved */
+ struct rtentry *pk_rt; /* back pointer to route */
+ struct rtentry *pk_llrt; /* pointer to reverse mapping */
+ u_short pk_refcount; /* ref count */
+};
+
+#define FOR_ALL_PKCBS(p) for((p) = (struct pkcb *)(pkcb_q.q_forw); \
+ (pkcb_q.q_forw != &pkcb_q) && ((struct pkcb_q *)(p) != &pkcb_q); \
+ (p) = (struct pkcb *)((p) -> pk_q.q_forw))
+
+#define PQEMPTY (pkcb_q.q_forw == &pkcb_q)
+
+/*
+ * Interface address, x25 version. Exactly one of these structures is
+ * allocated for each interface with an x25 address.
+ *
+ * The ifaddr structure conatins the protocol-independent part
+ * of the structure, and is assumed to be first.
+ */
+struct x25_ifaddr {
+ struct ifaddr ia_ifa; /* protocol-independent info */
+#define ia_ifp ia_ifa.ifa_ifp
+#define ia_flags ia_ifa.ifa_flags
+ struct x25config ia_xc; /* network specific configuration */
+ struct pkcb *ia_pkcb;
+#define ia_maxlcn ia_xc.xc_maxlcn
+ int (*ia_start) (); /* connect, confirm method */
+ struct sockaddr_x25 ia_dstaddr; /* reserve space for route dst */
+};
+
+/*
+ * ``Link-Level'' extension to Routing Entry for upper level
+ * packet switching via X.25 virtual circuits.
+ */
+struct llinfo_x25 {
+ struct llinfo_x25 *lx_next; /* chain together in linked list */
+ struct llinfo_x25 *lx_prev; /* chain together in linked list */
+ struct rtentry *lx_rt; /* back pointer to route */
+ struct pklcd *lx_lcd; /* local connection block */
+ struct x25_ifaddr *lx_ia; /* may not be same as rt_ifa */
+ int lx_state; /* can't trust lcd->lcd_state */
+ int lx_flags;
+ int lx_timer; /* for idle timeout */
+ int lx_family; /* for dispatch */
+};
+
+/* States for lx_state */
+#define LXS_NEWBORN 0
+#define LXS_RESOLVING 1
+#define LXS_FREE 2
+#define LXS_CONNECTING 3
+#define LXS_CONNECTED 4
+#define LXS_DISCONNECTING 5
+#define LXS_LISTENING 6
+
+/* flags */
+#define LXF_VALID 0x1 /* Circuit is live, etc. */
+#define LXF_RTHELD 0x2 /* this lcb references rtentry */
+#define LXF_LISTEN 0x4 /* accepting incoming calls */
+
+/*
+ * Definitions for accessing bitfields/bitslices inside X.25 structs
+ */
+
+
+struct x25bitslice {
+ unsigned int bs_mask;
+ unsigned int bs_shift;
+};
+
+#define calling_addrlen 0
+#define called_addrlen 1
+#define q_bit 2
+#define d_bit 3
+#define fmt_identifier 4
+#define lc_group_number 1
+#define p_r 5
+#define m_bit 6
+#define p_s 7
+#define zilch 8
+
+#define X25GBITS(Arg, Index) (((Arg) & x25_bitslice[(Index)].bs_mask) >> x25_bitslice[(Index)].bs_shift)
+#define X25SBITS(Arg, Index, Val) (Arg) |= (((Val) << x25_bitslice[(Index)].bs_shift) & x25_bitslice[(Index)].bs_mask)
+#define X25CSBITS(Arg, Index, Val) (Arg) = (((Val) << x25_bitslice[(Index)].bs_shift) & x25_bitslice[(Index)].bs_mask)
+
+extern struct x25bitslice x25_bitslice[];
+
+
+#define ISOFIFTTYPE(i,t) ((i)->if_type == (t))
+#define ISISO8802(i) ((ISOFIFTTYPE(i, IFT_ETHER) || \
+ ISOFIFTTYPE(i, IFT_ISO88023) || \
+ ISOFIFTTYPE(i, IFT_ISO88024) || \
+ ISOFIFTTYPE(i, IFT_ISO88025) || \
+ ISOFIFTTYPE(i, IFT_ISO88026) || \
+ ISOFIFTTYPE(i, IFT_P10) || \
+ ISOFIFTTYPE(i, IFT_P80) || \
+ ISOFIFTTYPE(i, IFT_FDDI)))
+
+/*
+ * miscellenous debugging info
+ */
+struct mbuf_cache {
+ int mbc_size;
+ int mbc_num;
+ int mbc_oldsize;
+ struct mbuf **mbc_cache;