/* * The default broadcast address of an interface is QST-0; the default address * is LINUX-1. The null address is defined as a callsign of all spaces with * an SSID of zero.
*/
/* * Compare two ax.25 addresses
*/ int ax25cmp(const ax25_address *a, const ax25_address *b)
{ int ct = 0;
while (ct < 6) { if ((a->ax25_call[ct] & 0xFE) != (b->ax25_call[ct] & 0xFE)) /* Clean off repeater bits */ return 1;
ct++;
}
if ((a->ax25_call[ct] & 0x1E) == (b->ax25_call[ct] & 0x1E)) /* SSID without control bit */ return 0;
return 2; /* Partial match */
}
EXPORT_SYMBOL(ax25cmp);
/* * Compare two AX.25 digipeater paths.
*/ int ax25digicmp(const ax25_digi *digi1, const ax25_digi *digi2)
{ int i;
if (digi1->ndigi != digi2->ndigi) return 1;
if (digi1->lastrepeat != digi2->lastrepeat) return 1;
for (i = 0; i < digi1->ndigi; i++) if (ax25cmp(&digi1->calls[i], &digi2->calls[i]) != 0) return 1;
return 0;
}
/* * Given an AX.25 address pull of to, from, digi list, command/response and the start of data *
*/ constunsignedchar *ax25_addr_parse(constunsignedchar *buf, int len,
ax25_address *src, ax25_address *dest, ax25_digi *digi, int *flags, int *dama)
{ int d = 0;
if (len < 14) return NULL;
if (flags != NULL) {
*flags = 0;
if (buf[6] & AX25_CBIT)
*flags = AX25_COMMAND; if (buf[13] & AX25_CBIT)
*flags = AX25_RESPONSE;
}
if (dama != NULL)
*dama = ~buf[13] & AX25_DAMA_FLAG;
/* Copy to, from */ if (dest != NULL)
memcpy(dest, buf + 0, AX25_ADDR_LEN); if (src != NULL)
memcpy(src, buf + 7, AX25_ADDR_LEN);
buf += 2 * AX25_ADDR_LEN;
len -= 2 * AX25_ADDR_LEN;
digi->lastrepeat = -1;
digi->ndigi = 0;
while (!(buf[-1] & AX25_EBIT)) { if (d >= AX25_MAX_DIGIS) return NULL; if (len < AX25_ADDR_LEN) return NULL;
memcpy(&digi->calls[d], buf, AX25_ADDR_LEN);
digi->ndigi = d + 1;
buf += AX25_ADDR_LEN;
len -= AX25_ADDR_LEN;
d++;
}
return buf;
}
/* * Assemble an AX.25 header from the bits
*/ int ax25_addr_build(unsignedchar *buf, const ax25_address *src, const ax25_address *dest, const ax25_digi *d, int flag, int modulus)
{ int len = 0; int ct = 0;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.