/* tp_input.c 1.2 82/05/15 */
#include "../h/protosw.h"
#include "../net/dn_systm.h"
#include "../net/tp_var.h"
* Initialize a few of the Transport variables here.
tprp
.tprp_nn
= 255; /* max node number */
* Attach a DECnet interface.
* For now, since we are an end node,
register struct ifnet
*ifp
;
printf("tp: Only one DECnet interface allowed, ");
printf("%s%d ignored\n", ifp
->if_name
, ifp
->if_unit
);
* Transport input routine. Decode header, process
* initialization messages, flush other control messages,
* and strip route headers and pass to NSP.
* Get next packet off input queue.
switch (*p
& TP_MSGTYPE
) {
* Transport initialization message from neighbor.
register struct tpin
*t
= (struct tpin
*)p
;
printf("tpinit: node %d, %d, blksize %d, ver %o.%o.%o\n",
D_SHORT(t
->tpin_srcnode
), t
->tpin_tiinfo
,
D_SHORT(t
->tpin_blksize
),
t
->tpin_ver
[0], t
->tpin_ver
[1], t
->tpin_ver
[2]);
/* perform a few consistency checks */
if (m
->m_len
< sizeof (struct tpin
)) {
if (D_SHORT(t
->tpin_srcnode
) > tprp
.tprp_nn
) {
if (tpstate
== TPS_TIS
) {
wakeup((caddr_t
)&tpstate
);
} else if (tpstate
== TPS_HALT
) {
* Route header. Flush bad ones,
* strip good ones and pass to NSP.
register struct tprh
*t
= (struct tprh
*)p
;
* Is it a reasonable route header?
if (tpstate
!= TPS_RUN
) {
printf("tp: not running!\n");
if (t
->tprh_rtflg
& TPRF_EV
) {
printf("tp: got P2 ASCII header\n");
if (t
->tprh_rtflg
& TPRF_RTS
) {
printf("tp: got returned packet\n");
if (m
->m_len
<= sizeof (struct tprh
)) {
printf("tp: got short packet, %d\n", m
->m_len
);
tpstat
.tps_shortpacket
++;
if (D_SHORT(t
->tprh_srcnode
) > tprp
.tprp_nn
) {
* add it to the NSP input queue.
if (D_SHORT(t
->tprh_dstnode
) != tp_host
) {
printf("tp: not for me, %d\n", D_SHORT(t
->tprh_dstnode
));
IF_ENQUEUE(&nspintrq
, m
);
* Verification messge. We should never see one
* of these because we never ask for one. Flush it.
printf("tp: got verification message\n");
* Hello and test message. Make sure it's
register struct tpht
*t
= (struct tpht
*)p
;
if (D_SHORT(t
->tpht_srcnode
) > tprp
.tprp_nn
) {
if ((i
= t
->tpht_cnt
) < 0 || i
> 128) {
printf("tp: test, bad count, %d\n", i
);
if (m
->m_len
!= sizeof (struct tpht
) + i
- 1) {
printf("tp: test, bad len, %d\n", m
->m_len
);
for (p
= t
->tpht_data
; i
--; p
++)
printf("tp: test, bad data, %o\n", *p
);
* Routing message. We should never get this,
* at least not yet. Just flush it.
printf("tp: got routing message\n");
printf("tp: unknown packet type, 0x%x\n", *p
);
* Free the current packet and get the next one.