Example #1
0
void
ipx_sap_print(__capability const u_short *ipx, u_int length)
{
    int command, i;

    PACKET_HAS_ONE_OR_TRUNC(ipx);
    command = EXTRACT_16BITS(ipx);
    ipx++;
    length -= 2;

    switch (command) {
      case 1:
      case 3:
	if (command == 1)
	    (void)printf("ipx-sap-req");
	else
	    (void)printf("ipx-sap-nearest-req");

	PACKET_HAS_ONE_OR_TRUNC(ipx);
	(void)printf(" %s", ipxsap_string(htons(EXTRACT_16BITS(&ipx[0]))));
	break;

      case 2:
      case 4:
	if (command == 2)
	    (void)printf("ipx-sap-resp");
	else
	    (void)printf("ipx-sap-nearest-resp");

	for (i = 0; i < 8 && length > 0; i++) {
	    PACKET_HAS_ONE_OR_TRUNC(ipx);
	    (void)printf(" %s '", ipxsap_string(htons(EXTRACT_16BITS(&ipx[0]))));
	    if (fn_printzp((packetbody_t)&ipx[1], 48, snapend)) {
		printf("'");
		goto trunc;
	    }
	    PACKET_HAS_SPACE_OR_TRUNC(ipx, (2 * 25) + 10);
	    printf("' addr %s",
		ipxaddr_string(EXTRACT_32BITS(&ipx[25]), (packetbody_t)&ipx[27]));
	    ipx += 32;
	    length -= 64;
	}
	break;
      default:
	(void)printf("ipx-sap-?%x", command);
	break;
    }
    return;
trunc:
    printf("[|ipx %d]", length);
}
Example #2
0
void
ipx_sap_print(const u_short *ipx, u_int length)
{
    int command, i;

    TCHECK(ipx[0]);
    command = EXTRACT_16BITS(ipx);
    ipx++;
    length -= 2;

    switch (command) {
      case 1:
      case 3:
	if (command == 1)
	    (void)printf("ipx-sap-req");
	else
	    (void)printf("ipx-sap-nearest-req");

	TCHECK(ipx[0]);
	(void)printf(" %s", ipxsap_string(htons(EXTRACT_16BITS(&ipx[0]))));
	break;

      case 2:
      case 4:
	if (command == 2)
	    (void)printf("ipx-sap-resp");
	else
	    (void)printf("ipx-sap-nearest-resp");

	for (i = 0; i < 8 && length > 0; i++) {
	    TCHECK(ipx[0]);
	    (void)printf(" %s '", ipxsap_string(htons(EXTRACT_16BITS(&ipx[0]))));
	    if (fn_printzp((u_char *)&ipx[1], 48, snapend)) {
		printf("'");
		goto trunc;
	    }
	    TCHECK2(ipx[25], 10);
	    printf("' addr %s",
		ipxaddr_string(EXTRACT_32BITS(&ipx[25]), (u_char *)&ipx[27]));
	    ipx += 32;
	    length -= 64;
	}
	break;
      default:
	(void)printf("ipx-sap-?%x", command);
	break;
    }
    return;
trunc:
    printf("[|ipx %d]", length);
}
Example #3
0
static void
ipx_sap_print(netdissect_options *ndo, const u_short *ipx, u_int length)
{
    int command, i;

    ND_TCHECK(ipx[0]);
    command = EXTRACT_16BITS(ipx);
    ipx++;
    length -= 2;

    switch (command) {
      case 1:
      case 3:
	if (command == 1)
	    ND_PRINT((ndo, "ipx-sap-req"));
	else
	    ND_PRINT((ndo, "ipx-sap-nearest-req"));

	ND_TCHECK(ipx[0]);
	ND_PRINT((ndo, " %s", ipxsap_string(htons(EXTRACT_16BITS(&ipx[0])))));
	break;

      case 2:
      case 4:
	if (command == 2)
	    ND_PRINT((ndo, "ipx-sap-resp"));
	else
	    ND_PRINT((ndo, "ipx-sap-nearest-resp"));

	for (i = 0; i < 8 && length > 0; i++) {
	    ND_TCHECK(ipx[0]);
	    ND_PRINT((ndo, " %s '", ipxsap_string(htons(EXTRACT_16BITS(&ipx[0])))));
	    if (fn_printzp(ndo, (u_char *)&ipx[1], 48, ndo->ndo_snapend)) {
		ND_PRINT((ndo, "'"));
		goto trunc;
	    }
	    ND_TCHECK2(ipx[25], 10);
	    ND_PRINT((ndo, "' addr %s",
		ipxaddr_string(EXTRACT_32BITS(&ipx[25]), (u_char *)&ipx[27])));
	    ipx += 32;
	    length -= 64;
	}
	break;
      default:
	ND_PRINT((ndo, "ipx-sap-?%x", command));
	break;
    }
    return;
trunc:
    ND_PRINT((ndo, "[|ipx %d]", length));
}