Revision 511d2b14 slirp/tcp_subr.c

b/slirp/tcp_subr.c
49 49
 * Tcp initialization
50 50
 */
51 51
void
52
tcp_init()
52
tcp_init(void)
53 53
{
54 54
	tcp_iss = 1;		/* wrong */
55 55
	tcb.so_next = tcb.so_prev = &tcb;
......
63 63
 */
64 64
/* struct tcpiphdr * */
65 65
void
66
tcp_template(tp)
67
	struct tcpcb *tp;
66
tcp_template(struct tcpcb *tp)
68 67
{
69 68
	struct socket *so = tp->t_socket;
70 69
	register struct tcpiphdr *n = &tp->t_template;
......
102 101
 * segment are as specified by the parameters.
103 102
 */
104 103
void
105
tcp_respond(tp, ti, m, ack, seq, flags)
106
	struct tcpcb *tp;
107
	register struct tcpiphdr *ti;
108
	register struct mbuf *m;
109
	tcp_seq ack, seq;
110
	int flags;
104
tcp_respond(struct tcpcb *tp, struct tcpiphdr *ti, struct mbuf *m,
105
            tcp_seq ack, tcp_seq seq, int flags)
111 106
{
112 107
	register int tlen;
113 108
	int win = 0;
......
122 117

  
123 118
	if (tp)
124 119
		win = sbspace(&tp->t_socket->so_rcv);
125
	if (m == 0) {
120
        if (m == NULL) {
126 121
		if ((m = m_get()) == NULL)
127 122
			return;
128 123
#ifdef TCP_COMPAT_42
......
152 147
	tlen += sizeof (struct tcpiphdr);
153 148
	m->m_len = tlen;
154 149

  
155
	ti->ti_mbuf = 0;
150
        ti->ti_mbuf = NULL;
156 151
	ti->ti_x1 = 0;
157 152
	ti->ti_seq = htonl(seq);
158 153
	ti->ti_ack = htonl(ack);
......
182 177
 * protocol control block.
183 178
 */
184 179
struct tcpcb *
185
tcp_newtcpcb(so)
186
	struct socket *so;
180
tcp_newtcpcb(struct socket *so)
187 181
{
188 182
	register struct tcpcb *tp;
189 183

  
......
257 251
 *	wake up any sleepers
258 252
 */
259 253
struct tcpcb *
260
tcp_close(tp)
261
	register struct tcpcb *tp;
254
tcp_close(struct tcpcb *tp)
262 255
{
263 256
	register struct tcpiphdr *t;
264 257
	struct socket *so = tp->t_socket;
......
281 274
 */
282 275
/*	free(tp, M_PCB);  */
283 276
	free(tp);
284
	so->so_tcpcb = 0;
277
        so->so_tcpcb = NULL;
285 278
	soisfdisconnected(so);
286 279
	/* clobber input socket cache if we're closing the cached connection */
287 280
	if (so == tcp_last_so)
......
333 326
 * We can let the user exit from the close as soon as the FIN is acked.
334 327
 */
335 328
void
336
tcp_sockclosed(tp)
337
	struct tcpcb *tp;
329
tcp_sockclosed(struct tcpcb *tp)
338 330
{
339 331

  
340 332
	DEBUG_CALL("tcp_sockclosed");
......
375 367
 * nonblocking.  Connect returns after the SYN is sent, and does
376 368
 * not wait for ACK+SYN.
377 369
 */
378
int tcp_fconnect(so)
379
     struct socket *so;
370
int tcp_fconnect(struct socket *so)
380 371
{
381 372
  int ret=0;
382 373

  
......
438 429
 * here and SYN the local-host.
439 430
 */
440 431
void
441
tcp_connect(inso)
442
	struct socket *inso;
432
tcp_connect(struct socket *inso)
443 433
{
444 434
	struct socket *so;
445 435
	struct sockaddr_in addr;
......
525 515
 * Attach a TCPCB to a socket.
526 516
 */
527 517
int
528
tcp_attach(so)
529
	struct socket *so;
518
tcp_attach(struct socket *so)
530 519
{
531 520
	if ((so->so_tcpcb = tcp_newtcpcb(so)) == NULL)
532 521
	   return -1;
......
558 547
#ifdef CONFIG_QEMU
559 548
static
560 549
#endif
561
struct emu_t *tcpemu = 0;
550
struct emu_t *tcpemu = NULL;
562 551

  
563 552
/*
564 553
 * Return TOS according to the above table
565 554
 */
566 555
u_int8_t
567
tcp_tos(so)
568
	struct socket *so;
556
tcp_tos(struct socket *so)
569 557
{
570 558
	int i = 0;
571 559
	struct emu_t *emup;
......
620 608
 * NOTE: if you return 0 you MUST m_free() the mbuf!
621 609
 */
622 610
int
623
tcp_emu(so, m)
624
	struct socket *so;
625
	struct mbuf *m;
611
tcp_emu(struct socket *so, struct mbuf *m)
626 612
{
627 613
	u_int n1, n2, n3, n4, n5, n6;
628 614
        char buff[257];
......
976 962
		}
977 963
#endif
978 964
        case EMU_FTP: /* ftp */
979
		*(m->m_data+m->m_len) = 0; /* NULL terminate for strstr */
965
                *(m->m_data+m->m_len) = 0; /* NUL terminate for strstr */
980 966
		if ((bptr = (char *)strstr(m->m_data, "ORT")) != NULL) {
981 967
			/*
982 968
			 * Need to emulate the PORT command
......
1244 1230
 * return 2 if this is a command-line connection
1245 1231
 */
1246 1232
int
1247
tcp_ctl(so)
1248
	struct socket *so;
1233
tcp_ctl(struct socket *so)
1249 1234
{
1250 1235
	struct sbuf *sb = &so->so_snd;
1251 1236
	int command;

Also available in: Unified diff