Lines Matching +full:0 +full:x25

33 #define pr_fmt(fmt) "X25: " fmt
57 #include <net/x25.h>
65 int sysctl_x25_forward = 0;
93 rc = 0; in x25_parse_address_block()
98 needed = 1 + ((len >> 4) + (len & 0x0f) + 1) / 2; in x25_parse_address_block()
110 *called_addr->x25_addr = 0; in x25_parse_address_block()
111 *calling_addr->x25_addr = 0; in x25_parse_address_block()
124 called_len = (*p >> 0) & 0x0F; in x25_addr_ntoa()
125 calling_len = (*p >> 4) & 0x0F; in x25_addr_ntoa()
131 for (i = 0; i < (called_len + calling_len); i++) { in x25_addr_ntoa()
133 if (i % 2 != 0) { in x25_addr_ntoa()
134 *called++ = ((*p >> 0) & 0x0F) + '0'; in x25_addr_ntoa()
137 *called++ = ((*p >> 4) & 0x0F) + '0'; in x25_addr_ntoa()
140 if (i % 2 != 0) { in x25_addr_ntoa()
141 *calling++ = ((*p >> 0) & 0x0F) + '0'; in x25_addr_ntoa()
144 *calling++ = ((*p >> 4) & 0x0F) + '0'; in x25_addr_ntoa()
149 *called = *calling = '\0'; in x25_addr_ntoa()
167 *p++ = (calling_len << 4) | (called_len << 0); in x25_addr_aton()
169 for (i = 0; i < (called_len + calling_len); i++) { in x25_addr_aton()
171 if (i % 2 != 0) { in x25_addr_aton()
172 *p |= (*called++ - '0') << 0; in x25_addr_aton()
175 *p = 0x00; in x25_addr_aton()
176 *p |= (*called++ - '0') << 4; in x25_addr_aton()
179 if (i % 2 != 0) { in x25_addr_aton()
180 *p |= (*calling++ - '0') << 0; in x25_addr_aton()
183 *p = 0x00; in x25_addr_aton()
184 *p |= (*calling++ - '0') << 4; in x25_addr_aton()
283 if (x25_sk(s)->cudmatchlength > 0 && in x25_find_listener()
287 x25_sk(s)->cudmatchlength)) == 0) { in x25_find_listener()
343 lci = 0; in x25_new_lci()
445 rc = 0; in x25_setsockopt()
464 if (len < 0) in x25_getsockopt()
474 rc = copy_to_user(optval, &val, len) ? -EFAULT : 0; in x25_getsockopt()
492 memset(&x25_sk(sk)->dest_addr, 0, X25_ADDR_LEN); in x25_listen()
495 rc = 0; in x25_listen()
503 .name = "X25",
510 struct x25_sock *x25; in x25_alloc_socket() local
518 x25 = x25_sk(sk); in x25_alloc_socket()
519 skb_queue_head_init(&x25->ack_queue); in x25_alloc_socket()
520 skb_queue_head_init(&x25->fragment_queue); in x25_alloc_socket()
521 skb_queue_head_init(&x25->interrupt_in_queue); in x25_alloc_socket()
522 skb_queue_head_init(&x25->interrupt_out_queue); in x25_alloc_socket()
531 struct x25_sock *x25; in x25_create() local
549 x25 = x25_sk(sk); in x25_create()
559 x25->t21 = sysctl_x25_call_request_timeout; in x25_create()
560 x25->t22 = sysctl_x25_reset_request_timeout; in x25_create()
561 x25->t23 = sysctl_x25_clear_request_timeout; in x25_create()
562 x25->t2 = sysctl_x25_ack_holdback_timeout; in x25_create()
563 x25->state = X25_STATE_0; in x25_create()
564 x25->cudmatchlength = 0; in x25_create()
565 set_bit(X25_ACCPT_APPRV_FLAG, &x25->flags); /* normally no cud */ in x25_create()
568 x25->facilities.winsize_in = X25_DEFAULT_WINDOW_SIZE; in x25_create()
569 x25->facilities.winsize_out = X25_DEFAULT_WINDOW_SIZE; in x25_create()
570 x25->facilities.pacsize_in = X25_DEFAULT_PACKET_SIZE; in x25_create()
571 x25->facilities.pacsize_out = X25_DEFAULT_PACKET_SIZE; in x25_create()
572 x25->facilities.throughput = 0; /* by default don't negotiate in x25_create()
574 x25->facilities.reverse = X25_DEFAULT_REVERSE; in x25_create()
575 x25->dte_facilities.calling_len = 0; in x25_create()
576 x25->dte_facilities.called_len = 0; in x25_create()
577 memset(x25->dte_facilities.called_ae, '\0', in x25_create()
578 sizeof(x25->dte_facilities.called_ae)); in x25_create()
579 memset(x25->dte_facilities.calling_ae, '\0', in x25_create()
580 sizeof(x25->dte_facilities.calling_ae)); in x25_create()
582 rc = 0; in x25_create()
590 struct x25_sock *x25, *ox25; in x25_make_new() local
595 if ((sk = x25_alloc_socket(sock_net(osk), 0)) == NULL) in x25_make_new()
598 x25 = x25_sk(sk); in x25_make_new()
610 x25->t21 = ox25->t21; in x25_make_new()
611 x25->t22 = ox25->t22; in x25_make_new()
612 x25->t23 = ox25->t23; in x25_make_new()
613 x25->t2 = ox25->t2; in x25_make_new()
614 x25->flags = ox25->flags; in x25_make_new()
615 x25->facilities = ox25->facilities; in x25_make_new()
616 x25->dte_facilities = ox25->dte_facilities; in x25_make_new()
617 x25->cudmatchlength = ox25->cudmatchlength; in x25_make_new()
619 clear_bit(X25_INTERRUPT_FLAG, &x25->flags); in x25_make_new()
628 struct x25_sock *x25; in x25_release() local
631 return 0; in x25_release()
633 x25 = x25_sk(sk); in x25_release()
637 switch (x25->state) { in x25_release()
641 x25_disconnect(sk, 0, 0, 0); in x25_release()
651 x25->state = X25_STATE_2; in x25_release()
661 x25_disconnect(sk, 0, 0, 0); in x25_release()
670 return 0; in x25_release()
677 int len, i, rc = 0; in x25_bind()
690 for (i = 0; i < len; i++) { in x25_bind()
733 rc = 0; in x25_wait_for_connection_establishment()
750 struct x25_sock *x25 = x25_sk(sk); in x25_connect() local
753 int rc = 0; in x25_connect()
789 x25->neighbour = x25_get_neigh(rt->dev); in x25_connect()
790 if (!x25->neighbour) in x25_connect()
793 x25_limit_facilities(&x25->facilities, x25->neighbour); in x25_connect()
795 x25->lci = x25_new_lci(x25->neighbour); in x25_connect()
796 if (!x25->lci) in x25_connect()
803 if (!strcmp(x25->source_addr.x25_addr, null_x25_address.x25_addr)) in x25_connect()
804 memset(&x25->source_addr, '\0', X25_ADDR_LEN); in x25_connect()
806 x25->dest_addr = addr->sx25_addr; in x25_connect()
812 x25->state = X25_STATE_1; in x25_connect()
829 rc = 0; in x25_connect()
831 if (rc && x25->neighbour) { in x25_connect()
833 x25_neigh_put(x25->neighbour); in x25_connect()
834 x25->neighbour = NULL; in x25_connect()
836 x25->state = X25_STATE_0; in x25_connect()
848 int rc = 0; in x25_wait_for_data()
861 rc = 0; in x25_wait_for_data()
909 rc = 0; in x25_accept()
921 struct x25_sock *x25 = x25_sk(sk); in x25_getname() local
922 int rc = 0; in x25_getname()
929 sx25->sx25_addr = x25->dest_addr; in x25_getname()
931 sx25->sx25_addr = x25->source_addr; in x25_getname()
963 if (addr_len <= 0) in x25_rx_call_request()
976 len = skb->data[0] + 1; in x25_rx_call_request()
1011 x25_forward_call(&dest_addr, nb, skb, lci) > 0) in x25_rx_call_request()
1098 rc = 0; in x25_rx_call_request()
1099 x25_transmit_clear_request(nb, lci, 0x01); in x25_rx_call_request()
1106 struct x25_sock *x25 = x25_sk(sk); in x25_sendmsg() local
1113 int qbit = 0, rc = -EINVAL; in x25_sendmsg()
1129 send_sig(SIGPIPE, current, 0); in x25_sendmsg()
1134 if (!x25->neighbour) in x25_sendmsg()
1143 if (strcmp(x25->dest_addr.x25_addr, sx25.sx25_addr.x25_addr)) in x25_sendmsg()
1159 sx25.sx25_addr = x25->dest_addr; in x25_sendmsg()
1203 if (test_bit(X25_Q_BIT_FLAG, &x25->flags)) { in x25_sendmsg()
1207 qbit = skb->data[0]; in x25_sendmsg()
1217 if (x25->neighbour->extended) { in x25_sendmsg()
1219 *asmptr++ = ((x25->lci >> 8) & 0x0F) | X25_GFI_EXTSEQ; in x25_sendmsg()
1220 *asmptr++ = (x25->lci >> 0) & 0xFF; in x25_sendmsg()
1224 *asmptr++ = ((x25->lci >> 8) & 0x0F) | X25_GFI_STDSEQ; in x25_sendmsg()
1225 *asmptr++ = (x25->lci >> 0) & 0xFF; in x25_sendmsg()
1229 if (x25->neighbour->extended) { in x25_sendmsg()
1232 *asmptr++ = ((x25->lci >> 8) & 0x0F) | X25_GFI_EXTSEQ; in x25_sendmsg()
1233 *asmptr++ = (x25->lci >> 0) & 0xFF; in x25_sendmsg()
1239 *asmptr++ = ((x25->lci >> 8) & 0x0F) | X25_GFI_STDSEQ; in x25_sendmsg()
1240 *asmptr++ = (x25->lci >> 0) & 0xFF; in x25_sendmsg()
1245 skb->data[0] |= X25_Q_BIT; in x25_sendmsg()
1256 skb_queue_tail(&x25->interrupt_out_queue, skb); in x25_sendmsg()
1260 if (rc < 0) in x25_sendmsg()
1262 else if (test_bit(X25_Q_BIT_FLAG, &x25->flags)) in x25_sendmsg()
1281 struct x25_sock *x25 = x25_sk(sk); in x25_recvmsg() local
1291 if (x25->neighbour == NULL) in x25_recvmsg()
1294 header_len = x25->neighbour->extended ? in x25_recvmsg()
1307 !skb_peek(&x25->interrupt_in_queue)) in x25_recvmsg()
1310 skb = skb_dequeue(&x25->interrupt_in_queue); in x25_recvmsg()
1320 if (test_bit(X25_Q_BIT_FLAG, &x25->flags)) { in x25_recvmsg()
1322 *asmptr = 0x00; in x25_recvmsg()
1337 qbit = (skb->data[0] & X25_Q_BIT) == X25_Q_BIT; in x25_recvmsg()
1341 if (test_bit(X25_Q_BIT_FLAG, &x25->flags)) { in x25_recvmsg()
1358 rc = skb_copy_datagram_msg(skb, 0, msg, copied); in x25_recvmsg()
1364 sx25->sx25_addr = x25->dest_addr; in x25_recvmsg()
1381 struct x25_sock *x25 = x25_sk(sk); in x25_ioctl() local
1390 if (amount < 0) in x25_ioctl()
1391 amount = 0; in x25_ioctl()
1398 int amount = 0; in x25_ioctl()
1441 rc = copy_to_user(argp, &x25->facilities, in x25_ioctl()
1442 sizeof(x25->facilities)) in x25_ioctl()
1443 ? -EFAULT : 0; in x25_ioctl()
1468 int out = facilities.throughput & 0xf0; in x25_ioctl()
1469 int in = facilities.throughput & 0x0f; in x25_ioctl()
1473 else if (out < 0x30 || out > 0xD0) in x25_ioctl()
1478 else if (in < 0x03 || in > 0x0D) in x25_ioctl()
1482 (facilities.reverse & 0x81) != 0x81) in x25_ioctl()
1484 x25->facilities = facilities; in x25_ioctl()
1485 rc = 0; in x25_ioctl()
1493 rc = copy_to_user(argp, &x25->dte_facilities, in x25_ioctl()
1494 sizeof(x25->dte_facilities)); in x25_ioctl()
1515 x25->dte_facilities = dtefacs; in x25_ioctl()
1516 rc = 0; in x25_ioctl()
1524 rc = copy_to_user(argp, &x25->calluserdata, in x25_ioctl()
1525 sizeof(x25->calluserdata)) in x25_ioctl()
1526 ? -EFAULT : 0; in x25_ioctl()
1541 x25->calluserdata = calluserdata; in x25_ioctl()
1543 rc = 0; in x25_ioctl()
1549 rc = copy_to_user(argp, &x25->causediag, sizeof(x25->causediag)) in x25_ioctl()
1550 ? -EFAULT : 0; in x25_ioctl()
1561 x25->causediag = causediag; in x25_ioctl()
1563 rc = 0; in x25_ioctl()
1581 x25->cudmatchlength = sub_addr.cudmatchlength; in x25_ioctl()
1582 rc = 0; in x25_ioctl()
1592 clear_bit(X25_ACCPT_APPRV_FLAG, &x25->flags); in x25_ioctl()
1593 rc = 0; in x25_ioctl()
1605 if (test_bit(X25_ACCPT_APPRV_FLAG, &x25->flags)) in x25_ioctl()
1608 x25->state = X25_STATE_3; in x25_ioctl()
1609 rc = 0; in x25_ioctl()
1659 sizeof(*x25_subscr32)) ? -EFAULT : 0; in compat_x25_subscr_ioctl()
1662 if (x25_subscr.extended == 0 || x25_subscr.extended == 1) { in compat_x25_subscr_ioctl()
1663 rc = 0; in compat_x25_subscr_ioctl()
1781 x25_disconnect(s, ENETUNREACH, 0, 0); in x25_kill_by_neigh()
1796 rc = proto_register(&x25_proto, 0); in x25_init()