Annotation of researchv8dc/sys/inet/socket.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * socket emulation routines
                      3:  * pretty much 4.2 sys/uipc_socket2.c
                      4:  */
                      5: #include "tcp.h"
                      6: #if NTCP > 0
                      7: 
                      8: #include "../h/param.h"
                      9: #include "../h/systm.h"
                     10: #include "../h/stream.h"
                     11: #include "../h/inet/in.h"
                     12: #include "../h/inet/mbuf.h"
                     13: #include "../h/inet/tcp.h"
                     14: #include "../h/inet/tcp_timer.h"
                     15: #include "../h/inet/socket.h"
                     16: #include "../h/inet/tcp_var.h"
                     17: 
                     18: extern struct tcpcb tcpcb[];
                     19: extern struct socket tcpsock[];
                     20: extern int Ntcp;
                     21: 
                     22: /*
                     23:  * Sequence from originating side is open /dev/tcp??, write
                     24:  * struct tcpuser (see tcp_device.c), the soisconnecting(),
                     25:  * soisconnected(), soisdisconnecting(), soisdisconnected().
                     26:  * On listening side, sonewconn(so) is called when a connection
                     27:  * is made to socket so, then soisconnected(), at which point the
                     28:  * user is notified and should open the new /dev/tcp??.
                     29:  */
                     30: 
                     31: soisconnecting(so)
                     32: register struct socket *so;
                     33: {
                     34:        so->so_state |= SS_ACTIVE;
                     35:        /* no need to wake up user */
                     36: }
                     37: 
                     38: soisconnected(so)
                     39: register struct socket *so;
                     40: {
                     41:        tcp_isconnected(so);    /* tell user */
                     42: }
                     43: 
                     44: soisdisconnecting(so)
                     45: register struct socket *so;
                     46: {
                     47:        so->so_state &= ~SS_PLEASEOPEN;
                     48:        tcp_hungup(so); /* sends M_HANGUP */
                     49: }
                     50: 
                     51: soisdisconnected(so)
                     52: register struct socket *so;
                     53: {
                     54:        so->so_state &= ~(SS_ACTIVE|SS_PLEASEOPEN|SS_RCVATMARK);
                     55:        if(so->so_state&SS_OPEN && !(so->so_state&SS_HUNGUP)) {
                     56:                so->so_state |= SS_HUNGUP;
                     57:                tcp_hungup(so);
                     58:        }
                     59: }
                     60: 
                     61: struct socket *
                     62: sonewconn(head)
                     63: register struct socket *head;
                     64: {
                     65:        register struct socket *so;
                     66:        extern struct socket *tcp_newconn();
                     67: 
                     68:        so = tcp_newconn(head);
                     69:        if(so == 0)
                     70:                goto bad;
                     71:        if(tcp_attach(so))
                     72:                goto bad;
                     73: 
                     74:        so->so_options = head->so_options & ~SO_ACCEPTCONN;
                     75:        so->so_state = SS_ACTIVE|SS_PLEASEOPEN;
                     76:        /* simulate PRU_ATTACH */
                     77:        return(so);
                     78: bad:
                     79:        printf("sonewconn bad\n");
                     80:        return(0);
                     81: }
                     82: 
                     83: soabort(so)
                     84: register struct socket *so;
                     85: {
                     86:        if(so->so_tcpcb)
                     87:                tcp_drop(so->so_tcpcb);
                     88: }
                     89: 
                     90: socantrcvmore(so)
                     91: struct socket *so;
                     92: {
                     93:        tcp_cantrcvmore(so);
                     94: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.