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


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



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

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

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

int _t_getinfo(int fd, struct t_info *info)
{
	union {
		struct {
			struct T_info_req msg;
		} req;
		struct {
			struct T_info_ack msg;
		} ack;
	} buf;
	buf.req.msg.PRIM_type = T_INFO_REQ;
	if (t_strioctl(fd, TI_GETINFO, &buf, sizeof(buf)) < 0)
		goto error;
	if (buf.ack.msg.PRIM_type != T_INFO_ACK)
		goto tproto;
	if (info) {
		info->addr = buf.ack.msg.ADDR_size;
		info->options = buf.ack.msg.OPT_size;
		info->tsdu = buf.ack.msg.TSDU_size;
		info->etsdu = buf.ack.msg.ETSDU_size;
		info->connect = buf.ack.msg.CDATA_size;
		info->discon = buf.ack.msg.DDATA_size;
		info->servtype = buf.ack.msg.SERV_type;
		info->flags = buf.ack.msg.PROVIDER_flag;
	}
	return (buf.ack.msg.CURRENT_state);
      tproto:
	t_errno = TPROTO;
	goto error;
      error:
	return (-1);
}

int _t_getsizes(int fd, struct t_info *info)
{
	int state;
	if ((state = t_getinfo(fd, info)) < 0)
		goto error;
	switch (info->addr) {
	case T_INVALID:
		info->addr = 0;
		break;
	case T_INFINITE:
		info->addr = _T_DEFAULT_ADDRLEN;
		break;
	}
	switch (info->options) {
	case T_INVALID:
		info->options = 0;
		break;
	case T_INFINITE:
		info->options = _T_DEFAULT_ADDRLEN;
		break;
	}
	switch (info->connect) {
	case T_INVALID:
		info->connect = 0;
		break;
	case T_INFINITE:
		info->connect = _T_DEFAULT_ADDRLEN;
		break;
	}
	return (state);
      error:
	return (-1);
}

int t_getinfo(int fd, struct t_info *info) {
	if (_t_getinfo(fd, info) >= 0)
		return (0);
	return(-1);
}



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

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

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