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_rcvconnect.c


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



#ident "@(#) $RCSfile: t_rcvconnect.c,v $ $Name:  $($Revision: 0.8.2.3 $) $Date: 2003/05/28 08:01:28 $"

static char const ident[] = "$RCSfile: t_rcvconnect.c,v $ $Name:  $($Revision: 0.8.2.3 $) $Date: 2003/05/28 08:01:28 $";

#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <sys/stropts.h>
#include <sys/xti.h>
#include <sys/tpi.h>
#include <timod.h>
#include "xti.h"

int _t_rcvconnect(int fd, struct t_call *call, struct t_info *info)
{
	union {
		struct {
			struct T_conn_con *prim;
			char addr[info->addr];
			char opts[info->options];
			char data[info->connect];
		} ret;
	} buf;
	int ret, flags = 0;
	struct strbuf ctrl;
	ctrl.len = ctrl.maxlen = sizeof(buf);
	ctrl.buf = (void *) &buf;
	if ((ret = t_getmsg(fd, &ctrl, (struct strbuf *) &call->udata, &flags)) < 0) {
		if (errno == EAGAIN)
			t_errno = TNODATA;
		goto error;
	}
	if (ret & MORECTL) {
		if (!info->addr || !info->options)
			goto tproto;
		while (ret & MORECTL) {
			ctrl.maxlen = ctrl.len = sizeof(buf.ret.prim) + info->addr + info->options;
			ctrl.len = 0;
			ctrl.buf = (char *) &buf;
			ret = t_getmsg(fd, &ctrl, NULL, &flags);
		}
		if (!info->connect)
			goto tproto;
		while (ret & MOREDATA) {
			struct strbuf data;
			data.maxlen = data.len = info->connect;
			data.buf = (char *) &call->udata;
			ret = t_getmsg(fd, NULL, &data, &flags);
		}
		goto tproto;
	}
	return (0);
      tproto:
	t_errno = TPROTO;
	goto error;
      error:
	return (-1);
}

int t_rcvconnect(int fd, struct t_call *call)
{
	struct t_info info = { 0, };
	int state;
	if ((state = _t_getsizes(fd, &info)) < 0)
		goto error;
	switch (state) {
	case TS_UNBND:
	case TS_WACK_BREQ:
	case TS_WACK_UREQ:
	case TS_IDLE:
	case TS_WACK_OPTREQ:
	case TS_WACK_CREQ:
	case TS_WCON_CREQ:
	case TS_WRES_CIND:
	case TS_WACK_CRES:
	case TS_DATA_XFER:
	case TS_WIND_ORDREL:
	case TS_WREQ_ORDREL:
	case TS_WACK_DREQ6:
	case TS_WACK_DREQ7:
	case TS_WACK_DREQ9:
	case TS_WACK_DREQ10:
	case TS_WACK_DREQ11:
	default:
	}
	/* 
	 *  We should first check the state of the underlying transport
	 *  provider to see if it is in the TS_WCON_CREQ state or is in the
	 *  TS_DATA_XFER state and there is a T_CONN_IND sitting on the
	 *  stream head read queue.
	 */
	return _t_rcvconnect(fd, call, &info);
      error:
	return (-1);
}


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

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

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