Lines Matching defs:kp
119 struct kinfo_pcb *kp;
222 if ((kp = pick_socket(&flist[i])) != NULL &&
224 print_socket(&flist[i], kp, &p);
387 socket_add_hash(struct kinfo_pcb *kp, int n)
400 si[i].s_sock = &kp[i];
401 hash = (int)(kp[i].ki_sockaddr % HASHSIZE);
407 isconnected(struct kinfo_pcb *kp)
410 if ((kp->ki_sostate & SS_ISCONNECTED) ||
411 (kp->ki_prstate >= INP_CONNECTED) ||
412 (kp->ki_tstate > TCPS_LISTEN) ||
413 (kp->ki_conn != 0))
420 islistening(struct kinfo_pcb *kp)
423 if (isconnected(kp))
426 if (kp->ki_tstate == TCPS_LISTEN)
429 switch (kp->ki_family) {
431 if (kp->ki_type == SOCK_RAW ||
432 (kp->ki_type == SOCK_DGRAM &&
433 ntohs(satosin(&kp->ki_src)->sin_port) != 0))
438 if (kp->ki_type == SOCK_RAW ||
439 (kp->ki_type == SOCK_DGRAM &&
440 ntohs(satosin6(&kp->ki_src)->sin6_port) != 0))
445 if (satosun(&kp->ki_src)->sun_path[0] != '\0')
459 struct kinfo_pcb *kp;
473 kp = si->s_sock;
476 if (isconnected(kp)) {
484 else if (islistening(kp)) {
501 switch (kp->ki_family) {
504 ntohs(satosin(&kp->ki_src)->sin_port)) &&
506 ntohs(satosin(&kp->ki_dst)->sin_port)))
512 ntohs(satosin6(&kp->ki_src)->sin6_port)) &&
514 ntohs(satosin6(&kp->ki_dst)->sin6_port)))
523 return (kp);
549 print_socket(struct kinfo_file *kf, struct kinfo_pcb *kp, struct kinfo_proc2 *p)
573 snprintf(proto, sizeof(proto), "%d/%d", kp->ki_family, kp->ki_protocol);
575 switch (kp->ki_family) {
577 switch (kp->ki_protocol) {
586 switch (kp->ki_protocol) {
595 switch (kp->ki_type) {
606 kp->ki_family, kp->ki_type, kp->ki_protocol);
614 if (kp->ki_family == PF_LOCAL) {
615 if (kp->ki_src.sa_len > 2) {
616 print_addr(0, kp->ki_type, kp->ki_pflags, &kp->ki_src);
617 if (kp->ki_dst.sa_family == PF_LOCAL)
620 if (kp->ki_dst.sa_family == PF_LOCAL)
624 print_addr(21, kp->ki_type, kp->ki_pflags, &kp->ki_src);
628 if (isconnected(kp))
629 print_addr(0, kp->ki_type, kp->ki_pflags, &kp->ki_dst);
630 else if (kp->ki_family == PF_INET
632 || kp->ki_family == PF_INET6
636 /* else if (kp->ki_src.sa_len == 2)