Lines Matching refs:sock

100 struct sock {  struct
111 struct sock *next; argument
115 static struct sock *sockhash[HASHSIZE];
272 free_socket(struct sock *sock) in free_socket() argument
276 cur = sock->laddr; in free_socket()
282 cur = sock->faddr; in free_socket()
288 free(sock); in free_socket()
294 struct sock *sock; in gather_sctp() local
330 if ((sock = calloc(1, sizeof *sock)) == NULL) in gather_sctp()
332 sock->socket = xinpcb->socket; in gather_sctp()
333 sock->proto = IPPROTO_SCTP; in gather_sctp()
334 sock->protoname = "sctp"; in gather_sctp()
336 sock->state = SCTP_CLOSED; in gather_sctp()
338 sock->state = SCTP_LISTEN; in gather_sctp()
340 sock->family = AF_INET6; in gather_sctp()
341 sock->vflag = INP_IPV6; in gather_sctp()
343 sock->family = AF_INET; in gather_sctp()
344 sock->vflag = INP_IPV4; in gather_sctp()
381 sock->laddr = laddr; in gather_sctp()
386 if (sock->laddr == NULL) { in gather_sctp()
387 if ((sock->laddr = calloc(1, sizeof(struct addr))) == NULL) in gather_sctp()
389 sock->laddr->address.ss_family = sock->family; in gather_sctp()
390 if (sock->family == AF_INET) in gather_sctp()
391 sock->laddr->address.ss_len = sizeof(struct sockaddr_in); in gather_sctp()
393 sock->laddr->address.ss_len = sizeof(struct sockaddr_in); in gather_sctp()
396 if ((sock->faddr = calloc(1, sizeof(struct addr))) == NULL) in gather_sctp()
398 sock->faddr->address.ss_family = sock->family; in gather_sctp()
399 if (sock->family == AF_INET) in gather_sctp()
400 sock->faddr->address.ss_len = sizeof(struct sockaddr_in); in gather_sctp()
402 sock->faddr->address.ss_len = sizeof(struct sockaddr_in); in gather_sctp()
412 hash = (int)((uintptr_t)sock->socket % HASHSIZE); in gather_sctp()
413 sock->next = sockhash[hash]; in gather_sctp()
414 sockhash[hash] = sock; in gather_sctp()
416 free_socket(sock); in gather_sctp()
423 if ((sock = calloc(1, sizeof *sock)) == NULL) in gather_sctp()
425 sock->socket = xinpcb->socket; in gather_sctp()
426 sock->proto = IPPROTO_SCTP; in gather_sctp()
427 sock->protoname = "sctp"; in gather_sctp()
428 sock->state = (int)xstcb->state; in gather_sctp()
430 sock->family = AF_INET6; in gather_sctp()
431 sock->vflag = INP_IPV6; in gather_sctp()
433 sock->family = AF_INET; in gather_sctp()
434 sock->vflag = INP_IPV4; in gather_sctp()
474 sock->laddr = laddr; in gather_sctp()
516 sock->faddr = faddr; in gather_sctp()
523 hash = (int)((uintptr_t)sock->socket % HASHSIZE); in gather_sctp()
524 sock->next = sockhash[hash]; in gather_sctp()
525 sockhash[hash] = sock; in gather_sctp()
527 free_socket(sock); in gather_sctp()
545 struct sock *sock; in gather_inet() local
656 if ((sock = calloc(1, sizeof(*sock))) == NULL) in gather_inet()
662 sock->socket = so->xso_so; in gather_inet()
663 sock->proto = proto; in gather_inet()
665 sock->family = AF_INET; in gather_inet()
666 sockaddr(&laddr->address, sock->family, in gather_inet()
668 sockaddr(&faddr->address, sock->family, in gather_inet()
671 sock->family = AF_INET6; in gather_inet()
672 sockaddr(&laddr->address, sock->family, in gather_inet()
674 sockaddr(&faddr->address, sock->family, in gather_inet()
679 sock->laddr = laddr; in gather_inet()
680 sock->faddr = faddr; in gather_inet()
681 sock->vflag = inp->inp_vflag; in gather_inet()
683 sock->state = xtp->xt_tp.t_state; in gather_inet()
684 sock->protoname = protoname; in gather_inet()
685 hash = (int)((uintptr_t)sock->socket % HASHSIZE); in gather_inet()
686 sock->next = sockhash[hash]; in gather_inet()
687 sockhash[hash] = sock; in gather_inet()
698 struct sock *sock; in gather_unix() local
760 if ((sock = calloc(1, sizeof(*sock))) == NULL) in gather_unix()
766 sock->socket = xup->xu_socket.xso_so; in gather_unix()
767 sock->pcb = xup->xu_unpp; in gather_unix()
768 sock->proto = proto; in gather_unix()
769 sock->family = AF_UNIX; in gather_unix()
770 sock->protoname = protoname; in gather_unix()
778 sock->laddr = laddr; in gather_unix()
779 sock->faddr = faddr; in gather_unix()
780 hash = (int)((uintptr_t)sock->socket % HASHSIZE); in gather_unix()
781 sock->next = sockhash[hash]; in gather_unix()
782 sockhash[hash] = sock; in gather_unix()
886 check_ports(struct sock *s) in check_ports()
955 displaysock(struct sock *s, int pos) in displaysock()
960 struct sock *s_tmp; in displaysock()
1058 struct sock *s; in display()