Lines Matching refs:sock

132 struct sock {  struct
134 RB_ENTRY(sock) socket_tree; /* tree of pcbs with socket */ argument
135 SLIST_ENTRY(sock) socket_list; /* list of pcbs w/o socket */
137 RB_ENTRY(sock) pcb_tree;
155 static RB_HEAD(socks_t, sock) socks = RB_INITIALIZER(&socks); argument
157 socket_compare(const struct sock *a, const struct sock *b) in socket_compare()
161 RB_GENERATE_STATIC(socks_t, sock, socket_tree, socket_compare);
163 static RB_HEAD(pcbs_t, sock) pcbs = RB_INITIALIZER(&pcbs);
165 pcb_compare(const struct sock *a, const struct sock *b) in pcb_compare()
169 RB_GENERATE_STATIC(pcbs_t, sock, pcb_tree, pcb_compare);
171 static SLIST_HEAD(, sock) nosocks = SLIST_HEAD_INITIALIZER(&nosocks);
356 free_socket(struct sock *sock) in free_socket() argument
360 cur = sock->laddr; in free_socket()
366 cur = sock->faddr; in free_socket()
372 free(sock); in free_socket()
378 struct sock *sock; in gather_sctp() local
414 if ((sock = calloc(1, sizeof *sock)) == NULL) in gather_sctp()
416 sock->socket = xinpcb->socket; in gather_sctp()
417 sock->proto = IPPROTO_SCTP; in gather_sctp()
418 sock->protoname = "sctp"; in gather_sctp()
420 sock->state = SCTP_CLOSED; in gather_sctp()
422 sock->state = SCTP_LISTEN; in gather_sctp()
424 sock->family = AF_INET6; in gather_sctp()
430 sock->vflag = INP_IPV6 | INP_IPV4; in gather_sctp()
432 sock->family = AF_INET; in gather_sctp()
433 sock->vflag = INP_IPV4; in gather_sctp()
470 sock->laddr = laddr; in gather_sctp()
475 if (sock->laddr == NULL) { in gather_sctp()
476 if ((sock->laddr = in gather_sctp()
479 sock->laddr->address.ss_family = sock->family; in gather_sctp()
480 if (sock->family == AF_INET) in gather_sctp()
481 sock->laddr->address.ss_len = in gather_sctp()
484 sock->laddr->address.ss_len = in gather_sctp()
488 if ((sock->faddr = calloc(1, sizeof(struct addr))) == NULL) in gather_sctp()
490 sock->faddr->address.ss_family = sock->family; in gather_sctp()
491 if (sock->family == AF_INET) in gather_sctp()
492 sock->faddr->address.ss_len = in gather_sctp()
495 sock->faddr->address.ss_len = in gather_sctp()
502 if (opt_l && (sock->vflag & vflag) && in gather_sctp()
506 RB_INSERT(socks_t, &socks, sock); in gather_sctp()
508 free_socket(sock); in gather_sctp()
515 if ((sock = calloc(1, sizeof *sock)) == NULL) in gather_sctp()
517 sock->socket = xinpcb->socket; in gather_sctp()
518 sock->proto = IPPROTO_SCTP; in gather_sctp()
519 sock->protoname = "sctp"; in gather_sctp()
520 sock->state = (int)xstcb->state; in gather_sctp()
522 sock->family = AF_INET6; in gather_sctp()
528 sock->vflag = INP_IPV6 | INP_IPV4; in gather_sctp()
530 sock->family = AF_INET; in gather_sctp()
531 sock->vflag = INP_IPV4; in gather_sctp()
574 sock->laddr = laddr; in gather_sctp()
621 sock->faddr = faddr; in gather_sctp()
627 if ((sock->vflag & vflag) && in gather_sctp()
631 RB_INSERT(socks_t, &socks, sock); in gather_sctp()
633 free_socket(sock); in gather_sctp()
650 struct sock *sock; in gather_inet() local
755 if ((sock = calloc(1, sizeof(*sock))) == NULL) in gather_inet()
761 sock->socket = so->xso_so; in gather_inet()
762 sock->pcb = so->so_pcb; in gather_inet()
763 sock->splice_socket = so->so_splice_so; in gather_inet()
764 sock->proto = proto; in gather_inet()
765 sock->inp_gencnt = xip->inp_gencnt; in gather_inet()
766 sock->fibnum = so->so_fibnum; in gather_inet()
768 sock->family = AF_INET; in gather_inet()
769 sockaddr(&laddr->address, sock->family, in gather_inet()
771 sockaddr(&faddr->address, sock->family, in gather_inet()
774 sock->family = AF_INET6; in gather_inet()
775 sockaddr(&laddr->address, sock->family, in gather_inet()
777 sockaddr(&faddr->address, sock->family, in gather_inet()
784 sock->laddr = laddr; in gather_inet()
785 sock->faddr = faddr; in gather_inet()
786 sock->vflag = xip->inp_vflag; in gather_inet()
788 sock->state = xtp->t_state; in gather_inet()
789 memcpy(sock->stack, xtp->xt_stack, in gather_inet()
791 memcpy(sock->cc, xtp->xt_cc, TCP_CA_NAME_MAX); in gather_inet()
793 sock->protoname = protoname; in gather_inet()
794 if (sock->socket != 0) in gather_inet()
795 RB_INSERT(socks_t, &socks, sock); in gather_inet()
797 SLIST_INSERT_HEAD(&nosocks, sock, socket_list); in gather_inet()
808 struct sock *sock; in gather_unix() local
869 if ((sock = calloc(1, sizeof(*sock))) == NULL) in gather_unix()
875 sock->socket = xup->xu_socket.xso_so; in gather_unix()
876 sock->pcb = xup->xu_unpp; in gather_unix()
877 sock->proto = proto; in gather_unix()
878 sock->family = AF_UNIX; in gather_unix()
879 sock->protoname = protoname; in gather_unix()
888 sock->laddr = laddr; in gather_unix()
889 sock->faddr = faddr; in gather_unix()
890 RB_INSERT(socks_t, &socks, sock); in gather_unix()
891 RB_INSERT(pcbs_t, &pcbs, sock); in gather_unix()
1023 check_ports(struct sock *s) in check_ports()
1119 struct sock *p; in format_unix_faddr()
1123 &(struct sock){ .pcb = faddr->conn }); in format_unix_faddr()
1151 struct sock *p; in format_unix_faddr()
1160 &(struct sock){ .pcb = ref })) != 0) { in format_unix_faddr()
1203 calculate_sock_column_widths(struct col_widths *cw, struct sock *s) in calculate_sock_column_widths()
1243 struct sock *sp; in calculate_sock_column_widths()
1245 sp = RB_FIND(socks_t, &socks, &(struct sock) in calculate_sock_column_widths()
1332 struct sock *s; in calculate_column_widths()
1342 &(struct sock){ .socket = xf->xf_data}); in calculate_column_widths()
1376 display_sock(struct sock *s, struct col_widths *cw, char *buf, size_t bufsize) in display_sock()
1458 struct sock *sp; in display_sock()
1459 sp = RB_FIND(socks_t, &socks, &(struct sock) in display_sock()
1566 struct sock *s; in display()
1637 &(struct sock){ .socket = xf->xf_data}); in display()