patch-2.1.42 linux/net/x25/x25_subr.c
Next file: linux/Documentation/Configure.help
Previous file: linux/net/x25/x25_route.c
Back to the patch index
Back to the overall index
- Lines: 108
- Date:
Wed May 28 10:49:12 1997
- Orig file:
v2.1.41/linux/net/x25/x25_subr.c
- Orig date:
Sun Jan 19 05:47:30 1997
diff -u --recursive --new-file v2.1.41/linux/net/x25/x25_subr.c linux/net/x25/x25_subr.c
@@ -281,106 +281,4 @@
return X25_ILLEGAL;
}
-/*
- * Parse a set of facilities into the facilities structure. Unrecognised
- * facilities are written to the debug log file.
- */
-int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities)
-{
- unsigned int len;
- unsigned char *p = skb->data;
-
- memset(facilities, 0x00, sizeof(struct x25_facilities));
-
- len = *p++;
-
- while (len > 0) {
- switch (*p & X25_FAC_CLASS_MASK) {
- case X25_FAC_CLASS_A:
- switch (*p) {
- case X25_FAC_REVERSE:
- facilities->reverse = (p[1] & 0x01);
- break;
- case X25_FAC_THROUGHPUT:
- facilities->throughput = p[1];
- break;
- default:
- printk(KERN_DEBUG "X.25: unknown facility %02X, value %02X\n", p[0], p[1]);
- break;
- }
- p += 2;
- len -= 2;
- break;
-
- case X25_FAC_CLASS_B:
- switch (*p) {
- case X25_FAC_PACKET_SIZE:
- facilities->pacsize_in = p[1];
- facilities->pacsize_out = p[2];
- break;
- case X25_FAC_WINDOW_SIZE:
- facilities->winsize_in = p[1];
- facilities->winsize_out = p[2];
- break;
- default:
- printk(KERN_DEBUG "X.25: unknown facility %02X, values %02X, %02X\n", p[0], p[1], p[2]);
- break;
- }
- p += 3;
- len -= 3;
- break;
-
- case X25_FAC_CLASS_C:
- printk(KERN_DEBUG "X.25: unknown facility %02X, values %02X, %02X, %02X\n", p[0], p[1], p[2], p[3]);
- p += 4;
- len -= 4;
- break;
-
- case X25_FAC_CLASS_D:
- printk(KERN_DEBUG "X.25: unknown facility %02X, length %d, values %02X, %02X, %02X, %02X\n", p[0], p[1], p[2], p[3], p[4], p[5]);
- p += p[1] + 2;
- len -= p[1] + 2;
- break;
- }
- }
-
- return p - skb->data;
-}
-
-/*
- * Create a set of facilities.
- */
-int x25_create_facilities(unsigned char *buffer, struct x25_facilities *facilities)
-{
- unsigned char *p = buffer + 1;
- int len;
-
- if (facilities->reverse != 0) {
- *p++ = X25_FAC_REVERSE;
- *p++ = (facilities->reverse) ? 0x01 : 0x00;
- }
-
- if (facilities->throughput != 0) {
- *p++ = X25_FAC_THROUGHPUT;
- *p++ = facilities->throughput;
- }
-
- if (facilities->pacsize_in != 0 || facilities->pacsize_out != 0) {
- *p++ = X25_FAC_PACKET_SIZE;
- *p++ = (facilities->pacsize_in == 0) ? facilities->pacsize_out : facilities->pacsize_in;
- *p++ = (facilities->pacsize_out == 0) ? facilities->pacsize_in : facilities->pacsize_out;
- }
-
- if (facilities->winsize_in != 0 || facilities->winsize_out != 0) {
- *p++ = X25_FAC_WINDOW_SIZE;
- *p++ = (facilities->winsize_in == 0) ? facilities->winsize_out : facilities->winsize_in;
- *p++ = (facilities->winsize_out == 0) ? facilities->winsize_in : facilities->winsize_out;
- }
-
- len = p - buffer;
- buffer[0] = len - 1;
-
- return len;
-}
-
#endif
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov