Lines Matching defs:so

156 #define	TCPDEBUG2(req)	if (tp && (so->so_options & SO_DEBUG)) \
178 tcp_usr_attach(struct socket *so, __unused int proto, struct proc *p)
181 struct inpcb *inp = sotoinpcb(so);
191 error = tcp_attach(so, p);
195 if ((so->so_options & SO_LINGER) && so->so_linger == 0)
196 so->so_linger = TCP_LINGERTIME * hz;
197 tp = sototcpcb(so);
211 tcp_usr_detach(struct socket *so)
214 struct inpcb *inp = sotoinpcb(so);
221 lck_mtx_assert(&((struct inpcb *)so->so_pcb)->inpcb_mtx, LCK_MTX_ASSERT_OWNED);
264 tcp_usr_bind(struct socket *so, struct sockaddr *nam, struct proc *p)
267 struct inpcb *inp = sotoinpcb(so);
297 tcp6_usr_bind(struct socket *so, struct sockaddr *nam, struct proc *p)
300 struct inpcb *inp = sotoinpcb(so);
357 tcp_usr_listen(struct socket *so, struct proc *p)
360 struct inpcb *inp = sotoinpcb(so);
373 tcp6_usr_listen(struct socket *so, struct proc *p)
376 struct inpcb *inp = sotoinpcb(so);
400 tcp_usr_connect(struct socket *so, struct sockaddr *nam, struct proc *p)
403 struct inpcb *inp = sotoinpcb(so);
411 if (so->so_error) {
412 error = so->so_error;
413 so->so_error = 0;
446 tcp6_usr_connect(struct socket *so, struct sockaddr *nam, struct proc *p)
449 struct inpcb *inp = sotoinpcb(so);
507 tcp_usr_disconnect(struct socket *so)
510 struct inpcb *inp = sotoinpcb(so);
513 lck_mtx_assert(&((struct inpcb *)so->so_pcb)->inpcb_mtx, LCK_MTX_ASSERT_OWNED);
528 tcp_usr_accept(struct socket *so, struct sockaddr **nam)
531 struct inpcb *inp = sotoinpcb(so);
535 in_setpeeraddr(so, nam);
537 if (so->so_state & SS_ISDISCONNECTED) {
554 tcp6_usr_accept(struct socket *so, struct sockaddr **nam)
557 struct inpcb *inp = sotoinpcb(so);
561 if (so->so_state & SS_ISDISCONNECTED) {
573 in6_mapped_peeraddr(so, nam);
596 tcp_usr_shutdown(struct socket *so)
599 struct inpcb *inp = sotoinpcb(so);
603 socantsendmore(so);
617 tcp_usr_rcvd(struct socket *so, __unused int flags)
620 struct inpcb *inp = sotoinpcb(so);
627 tcp_sbrcv_trim(tp, &so->so_rcv);
665 tcp_usr_send(struct socket *so, int flags, struct mbuf *m,
669 struct inpcb *inp = sotoinpcb(so);
711 sbappendstream(&so->so_snd, m);
736 socantsendmore(so);
747 if (sbspace(&so->so_snd) == 0) {
762 sbappendstream(&so->so_snd, m);
781 tp->snd_up = tp->snd_una + so->so_snd.sb_cc;
794 tcp_usr_abort(struct socket *so)
797 struct inpcb *inp = sotoinpcb(so);
805 so->so_usecount--;
818 tcp_usr_rcvoob(struct socket *so, struct mbuf *m, int flags)
821 struct inpcb *inp = sotoinpcb(so);
825 if ((so->so_oobmark == 0 &&
826 (so->so_state & SS_RCVATMARK) == 0) ||
827 so->so_options & SO_OOBINLINE ||
893 struct socket *so = inp->inp_socket;
971 tcp_set_max_rwinscale(tp, so);
973 soisconnecting(so);
1012 struct socket *so = inp->inp_socket;
1033 * even in the error case, so make sure that it's released
1078 tcp_set_max_rwinscale(tp, so);
1080 soisconnecting(so);
1188 struct socket *so;
1225 if (inp == NULL || (so = inp->inp_socket) == NULL)
1228 socket_lock(so, 0);
1230 socket_unlock(so, 0);
1236 socket_unlock(so, 0);
1272 tcp_lookup_peer_pid_locked(struct socket *so, pid_t *out_pid)
1276 if ((so->so_state & SS_ISCONNECTED) == 0) return ENOTCONN;
1278 struct inpcb *inp = (struct inpcb*)so->so_pcb;
1286 socket_unlock(so, 0);
1288 socket_lock(so, 0);
1292 socket_unlock(so, 0);
1294 socket_lock(so, 0);
1314 tcp_ctloutput(so, sopt)
1315 struct socket *so;
1323 inp = sotoinpcb(so);
1331 if (INP_CHECK_SOCKAF(so, AF_INET6))
1332 error = ip6_ctloutput(so, sopt);
1335 error = ip_ctloutput(so, sopt);
1508 so->so_flags &= ~(SOF_NOTSENT_LOWAT);
1511 so->so_flags |= SOF_NOTSENT_LOWAT;
1584 if ((so->so_flags & SOF_NOTSENT_LOWAT) != 0) {
1592 error = tcp_lookup_peer_pid_locked(so, &pid);
1669 tcp_attach(so, p)
1670 struct socket *so;
1677 int isipv6 = INP_CHECK_SOCKAF(so, AF_INET6) != 0;
1680 error = in_pcballoc(so, &tcbinfo, p);
1684 inp = sotoinpcb(so);
1686 if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) {
1687 error = soreserve(so, tcp_sendspace, tcp_recvspace);
1691 if ((so->so_rcv.sb_flags & SB_USRSIZE) == 0)
1692 so->so_rcv.sb_flags |= SB_AUTOSIZE;
1693 if ((so->so_snd.sb_flags & SB_USRSIZE) == 0)
1694 so->so_snd.sb_flags |= SB_AUTOSIZE;
1706 int nofd = so->so_state & SS_NOFDREF; /* XXX */
1708 so->so_state &= ~SS_NOFDREF; /* don't free the socket yet */
1715 so->so_state |= nofd;
1737 struct socket *so = tp->t_inpcb->inp_socket;
1741 else if ((so->so_options & SO_LINGER) && so->so_linger == 0)
1744 soisdisconnecting(so);
1745 sbflush(&so->so_rcv);