OpenSS7
SS7 for the
Common Man

© Copyright 1997-2004,OpenSS7 Corporation, All Rights Reserved.
Last modified:

Home Overview Status News Documentation Resources About
   
 Overview
 Status
 News
 Documentation
 Resources
 About

   
Home Index Prev Next More Download Info FAQ Mail   Home -> Resources -> Browse Source -> strss7/lib/libxnet/t_accept.c


File /code/strss7/lib/libxnet/t_accept.c



#ident "@(#) $RCSfile: t_accept.c,v $ $Name:  $($Revision: 0.8 $) $Date: 2003/05/26 07:44:40 $"

static char const ident[] = "$RCSfile: t_accept.c,v $ $Name:  $($Revision: 0.8 $) $Date: 2003/05/26 07:44:40 $";

int t_accept(int fd, int resfd, struct t_call *call)
{
	mblk_t *mp, *dp;
	struct T_conn_res *p;
	struct strbuf ctl;
	struct strbuf dat;
	unsigned char *buf, *wptr;
	struct strfdinsert fdi;
	if (!call)
		goto tproto;
	if (!(buf = wptr = malloc(sizeof(*p) + call->addr.len + call->opt.len)))
		goto tsyserr;
	p = (typeof(p)) wptr++;
	p->PRIM_type = T_CONN_RES;
	p->ACCEPTOR_id = 0;
	p->OPT_length = call->opt.len;
	p->OPT_offset = call->opt.len ? sizeof(*p) : 0;
	p->SEQ_number = call->sequence;
	if (call->opt.len) {
		bcopy(call->opt.buf, call->opt.len);
		wptr += call->opt.len;
	}
	ctl.maxlen = 0;
	ctl.len = (wptr - buf);
	ctl.buf = buf;
	dat.maxlen = 0;
	dat.len = call->udata.len;
	dat.buf = call->udata.len ? call->udata.buf : NULL;
	fdi->ctlbuf = &ctl;
	fdi->databuf = &dat;
	fdi->flags = 0;
	fdi->filedes = resfd;
	fdi->offset = ((char *) &p->ACCEPTOR_id) - ((char *) p);
	if (ioctl(fd, I_FDINSERT, &fdi) < 0) {
		if (errno == EINVAL)
			goto tbadf;
		goto tsyserr;
	}
      tbadf:
	t_errno = TBADF;
	goto error;
      tsyserr:
	t_errno = TSYSERR;
	goto error;
      tproto:
	t_errno = TPROTO;
	goto error;
      error:
	return (-1);
}


Home Index Prev Next More Download Info FAQ Mail   Home -> Resources -> Browse Source -> strss7/lib/libxnet/t_accept.c

OpenSS7
SS7 for the
Common Man
Home Overview Status News Documentation Resources About

© Copyright 1997-2004,OpenSS7 Corporation, All Rights Reserved.
Last modified: