Lines Matching refs:so

67 	struct socket *so = tp->t_socket;
74 n->ti_src = so->so_faddr;
75 n->ti_dst = so->so_laddr;
76 n->ti_sport = so->so_fport;
77 n->ti_dport = so->so_lport;
133 * ti points into m so the next line is just making
179 tcp_newtcpcb(struct socket *so)
192 tp->t_socket = so;
195 * Init srtt to TCPTV_SRTTBASE (0), so we can tell that we have no
196 * rtt estimate. Set rttvar so that srtt + 2 * rttvar gives
211 so->so_tcpcb = tp;
242 /* so->so_error = errno; */
256 struct socket *so = tp->t_socket;
276 so->so_tcpcb = NULL;
277 soisfdisconnected(so);
279 if (so == tcp_last_so)
281 closesocket(so->s);
282 sbfree(&so->so_rcv);
283 sbfree(&so->so_snd);
284 sofree(so);
369 int tcp_fconnect(struct socket *so)
374 DEBUG_ARG("so = %lx", (long )so);
376 if( (ret=so->s=socket(AF_INET,SOCK_STREAM,0)) >= 0) {
377 int opt, s=so->s;
387 if ((so->so_faddr.s_addr & htonl(0xffffff00)) == special_addr.s_addr) {
389 switch(ntohl(so->so_faddr.s_addr) & 0xff) {
399 addr.sin_addr = so->so_faddr;
400 addr.sin_port = so->so_fport;
409 * If it's not in progress, it failed, so we just return 0,
412 soisfconnecting(so);
427 * the time it gets to accept(), so... We simply accept
433 struct socket *so;
448 so = inso;
450 if ((so = socreate()) == NULL) {
455 if (tcp_attach(so) < 0) {
456 free(so); /* NOT sofree */
459 so->so_laddr = inso->so_laddr;
460 so->so_lport = inso->so_lport;
463 (void) tcp_mss(sototcpcb(so), 0);
466 tcp_close(sototcpcb(so)); /* This will sofree() as well */
477 so->so_fport = addr.sin_port;
478 so->so_faddr = addr.sin_addr;
480 if (so->so_faddr.s_addr == 0 || so->so_faddr.s_addr == loopback_addr.s_addr)
481 so->so_faddr = alias_addr;
485 closesocket(so->s); /* If we only accept once, close the accept() socket */
486 so->so_state = SS_NOFDREF; /* Don't select it yet, even though we have an FD */
489 so->s = s;
491 so->so_iptos = tcp_tos(so);
492 tp = sototcpcb(so);
498 * (TCP_MAXWIN << tp->request_r_scale) < so->so_rcv.sb_hiwat)
502 /* soisconnecting(so); */ /* NOFDREF used instead */
517 tcp_attach(struct socket *so)
519 if ((so->so_tcpcb = tcp_newtcpcb(so)) == NULL)
522 insque(so, &tcb);
555 tcp_tos(struct socket *so)
561 if ((tcptos[i].fport && (ntohs(so->so_fport) == tcptos[i].fport)) ||
562 (tcptos[i].lport && (ntohs(so->so_lport) == tcptos[i].lport))) {
563 so->so_emu = tcptos[i].emu;
571 if ((emup->fport && (ntohs(so->so_fport) == emup->fport)) ||
572 (emup->lport && (ntohs(so->so_lport) == emup->lport))) {
573 so->so_emu = emup->emu;
598 * LOWDELAY and so Nagel will kick in. Because of this,
599 * we'll get the first letter, followed by the rest, so
610 tcp_emu(struct socket *so, struct mbuf *m)
619 DEBUG_ARG("so = %lx", (long)so);
622 switch(so->so_emu) {
634 struct sbuf *so_rcv = &so->so_rcv;
646 if (tmpso->so_laddr.s_addr == so->so_laddr.s_addr &&
648 tmpso->so_faddr.s_addr == so->so_faddr.s_addr &&
679 struct sbuf *so_snd = &so->so_snd;
680 struct sbuf *so_rcv = &so->so_rcv;
683 if (ntohs(so->so_lport) > 1023 || ntohs(so->so_lport) < 512 ||
688 tcp_sockclosed(sototcpcb(so));
712 ptr, inet_ntoa(so->so_faddr));
740 fork_exec(so, args, 2);
742 so->so_emu = 0;
763 struct sbuf *so_snd = &so->so_snd;
764 struct sbuf *so_rcv = &so->so_rcv;
767 if (ntohs(so->so_lport) > 1023 || ntohs(so->so_lport) < 512 ||
772 tcp_sockclosed(sototcpcb(so));
791 if (so->extra==NULL) {
800 tcp_sockclosed(sototcpcb(so));
810 ns->so_laddr=so->so_laddr;
815 ns->so_faddr=so->so_faddr;
829 * (TCP_MAXWIN << tp->request_r_scale) < so->so_rcv.sb_hiwat)
843 so->extra=ns;
859 rsh_exec(so,so->extra, user, inet_ntoa(so->so_faddr), args);
860 so->so_emu = 0;
861 so->extra=NULL;
874 struct sbuf *so_snd = &so->so_snd;
875 struct sbuf *so_rcv = &so->so_rcv;
878 * If there is binary data here, we save it in so->so_m
880 if (!so->so_m) {
886 so->so_m = m;
890 } /* if(so->so_m==NULL) */
916 tcp_output(sototcpcb(so)); /* XXX */
921 while (num < so->so_rcv.sb_cc) {
922 if (*(so->so_rcv.sb_rptr + num) == '\n' ||
923 *(so->so_rcv.sb_rptr + num) == '\r') {
942 n = do_config(so_rcv->sb_rptr, so, PRN_SPRINTF);
956 tcp_output(sototcpcb(so)); /* Send the reply */
977 if ((so = solisten(0, laddr, lport, SS_FACCEPTONCE)) == NULL)
980 n6 = ntohs(so->so_fport);
985 laddr = ntohl(so->so_faddr.s_addr);
1009 if ((so = solisten(0, laddr, lport, SS_FACCEPTONCE)) == NULL)
1012 n6 = ntohs(so->so_fport);
1017 laddr = ntohl(so->so_faddr.s_addr);
1041 so->so_emu = 0;
1049 (so = solisten(0, so->so_laddr.s_addr, htons(lport), SS_FACCEPTONCE)) != NULL)
1051 ntohs(so->so_fport)) + 1;
1064 if ((so = solisten(0, htonl(laddr), htons(lport), SS_FACCEPTONCE)) == NULL)
1070 (unsigned long)ntohl(so->so_faddr.s_addr),
1071 ntohs(so->so_fport), 1);
1073 if ((so = solisten(0, htonl(laddr), htons(lport), SS_FACCEPTONCE)) == NULL)
1079 (unsigned long)ntohl(so->so_faddr.s_addr),
1080 ntohs(so->so_fport), n1, 1);
1082 if ((so = solisten(0, htonl(laddr), htons(lport), SS_FACCEPTONCE)) == NULL)
1088 (unsigned long)ntohl(so->so_faddr.s_addr),
1089 ntohs(so->so_fport), n1, 1);
1198 so->so_laddr.s_addr,
1221 so->so_emu = 0;
1232 tcp_ctl(struct socket *so)
1234 struct sbuf *sb = &so->so_snd;
1241 DEBUG_ARG("so = %lx", (long )so);
1247 if (ctl_addr.s_addr && (ctl_addr.s_addr == -1 || (so->so_laddr.s_addr != ctl_addr.s_addr))) {
1253 command = (ntohl(so->so_faddr.s_addr) & 0xff);
1262 if (ex_ptr->ex_fport == so->so_fport &&
1265 so->s = -1;
1266 so->extra = (void *)ex_ptr->ex_exec;
1277 /* tcp_fconnect(so); */
1288 return(fork_exec(so, ex_ptr->ex_exec, do_pty));
1303 so->so_emu = EMU_CTL;