Esempio n. 1
0
/*
 *	_tmf_closev - Switches tape volume
 *
 *	returns:
 *		 0	OK
 *		-1	error (errno is set)
 */
int
_tmf_closev(struct fdinfo *fio, struct ffsw *st)
{
	tmfreqhdr_t	ctl;
	struct tmfio	*xfinfo;

	xfinfo	= (struct tmfio *)fio->lyr_info;

	if (xfinfo->tmf_tpos){
		if (_tmf_tpwait(xfinfo) < 0){
			return(ERR);
		}
	}
/*
 *	If the file's been writing, flush out data.
 *	If we've been reading, clear out any unread data.
 */
	if (_tmf_flush(fio, st) < 0){
		return(ERR);
	}

	bzero(&ctl, sizeof(tmfreqhdr_t));
	ctl.request	= TR_CLV;

	if(ioctl(xfinfo->tmf_fd, TMFC_DMNREQ, &ctl) <0) {
		ERETURN(st, errno, 0);
	}

	if (ctl.reply != 0) {
		ERETURN(st, ctl.reply, 0);
	}

	return(0);
}
Esempio n. 2
0
/*
 * Change the tape position by ntpmk tape marks 
 * Note that this routine does not set stat.sw_stat unless
 * there is an error. We could probably set it to EOD and BOD,
 * but setting it to EOF is ???
 * Skips the specified number of tape marks. If skipping forward,
 * it will position you directly after a user tape mark or at EOD.
 * If skipping backwards, it will position you directly before a
 * user tape mark or at BOD
 */
int
_tmf_skiptpmk(
	int		fd,
	int		ntpmk,
	int		*rescnt,
	struct ffsw	*stat)
{
	tmfpfm_t	ctl;

	*rescnt		= 0;	/* residual count */
	bzero(&ctl, sizeof(ctl));
	ctl.rh.request	= TR_PFMS;
	ctl.rh.length	= sizeof(tmfpfm_t) - sizeof(tmfreqhdr_t);
	ctl.count	= ntpmk;

	if (ioctl(fd, TMFC_DMNREQ, &ctl) < 0) {
		ERETURN(stat, errno, 0);
	}

	*rescnt	= ctl.rh.residual;

	if (ctl.rh.reply != 0) {
		ERETURN(stat, ctl.rh.reply, 0);
	}
		
	return(0);
}
Esempio n. 3
0
/***
	PUBLIC
	Metodo ClearSynonym
	Realiza a delecao de todas as definicoes de sinonimos feita para o
	objeto LTC_SYNONYM.

	Parameters:
		-

	Return:
		0 se operacao OK ou negativo caso contrario.

	Comments:
		-

***/
int
LBSC_Base::ClearSynonym()
{
	PRINTLOG( _clLBSLog, ("LBSC_Base::ClearSynonym") );

	CLBAutoRegCrit	AutoRegCrit(&rcRegCrit);

	if( !plbscisIndexSystem ){
		ERETURN( LBSE_INVALIDINDEXSYSTEM );
	}

	if( pltcSynonym ){
		int iRet = pltcSynonym->LT_ClearSynonym();
		if( iRet == 0 ){
			LTC_SYNONYM *pAux = plbscisIndexSystem->LT_SetSynonym( NULL );
			if( pAux ){
				delete pAux;
			}
			SetError( plbscisIndexSystem->GetError() );
		} else {
			SetError( pltcSynonym->GetError() );
		}
		return( iRet );
	}
	ERETURN( LBSE_NOMEMORY );
}
Esempio n. 4
0
/***
	PRIVATE
	Metodo GetUserType
	Obtem o tipo de um usuario

	Parameters:
		-
		-

	Return:
		- o tipo do usuario ou um valor negativo indicando erro

	Comments:
		-

***/
long
LBSC_Session::GetUserType( LBSC_Base *pUDB, char *szUserName )
{
	PRINTLOG( _clLBSLog, ("LBSC_Session::GetUserType") );

	if( !pUDB || !szUserName ){
		ERETURN( LBSE_BADARG );
	}
	// procurar o usuario na UDB (a password nao interessa)
	int iRet = FindUser( pUDB, szUserName, "$" );
	if( iRet != LBS_OK && iRet != LBSE_INVALIDPASSWORD ){
		// fudeu
		ERETURN( iRet );
	}
	LBSC_Field	*pf = (*pUDB)[ USERBASEUSERTYPE ];
	if( !pf ){
		ERETURN( LBSE_BADUSERBASE );
	}
	LBSC_Data	*pd = (*pf)[ 0 ];
	if( !pd ){
		ERETURN( LBSE_BADUSERBASE );
	}
	long lType = (long) (*pd);
	SetError( LBS_OK );
	return( lType );
}
Esempio n. 5
0
int
_er90b_write(struct fdinfo *fio, bitptr bufptr, int nbytes, 
	struct ffsw *retstat, int fulp, int *ubc)
{
int ret;
int nbt = 0;	/* number of bytes transferred so far */
int nbreq;	/* number of bytes requested this request */
char *buf;
ER90BYT *f;
int zero = 0;
struct ffsw dumstat;

	buf = BPTR2CP(bufptr);
	if ((BPBITOFF(bufptr) & 7) != 0 || *ubc != 0)
		ERETURN(retstat, FDC_ERR_UBC, 0);

	nbreq = nbytes;
	if (fio->rwflag == POSITIN) {
		f = (ER90BYT *)fio->lyr_info;
		if (f->tpos) {
			ret = _tape_tpwait(f->fd, &(f->tpos));
			if (ret < 0)
				ERETURN(retstat, errno, 0);
		}		
	}
	else if (fio->rwflag == READIN) {
		/* write after read requires position to zero */
		ret = _er90b_pos(fio, FP_RSEEK, &zero, 1,
			&dumstat);
		if (ret < 0) {
			*retstat = dumstat;
			return(ERR);
		}
	}
	if (nbreq > 0) {
again:
		/* It is not safe to reissue the write if it fails */
		/* with EINTR. Some data may have been transferred */
		ret= write(fio->realfd, buf, nbreq);
		if (ret < 0)
			ERETURN(retstat, errno, nbt);
		nbt += ret;
/*
 *		The assumption is made here that the system will never return
 *		zero bytes on a non-zero request without an error!
 */
		if (nbt < nbytes) {
			buf += ret;
			nbreq -= ret;
			goto again;
		}
	}
	else if (nbytes < 0)
		ERETURN(retstat, FDC_ERR_REQ, 0);

	SETSTAT(retstat, FFCNT, nbt);
	fio->rwflag = WRITIN;
	return (nbt);
}
Esempio n. 6
0
/*
 * Switch from read mode into write mode.
 * We have to do a space command for this to work.
 * We try backspacing then forward spacing
 *
 * Return value:
 *	 0 if OK
 *	-1 if error.  Error code set in stat->sw_error
 */
static int
_tmf_wrard(
	struct fdinfo	*fio,
	struct ffsw	*stat)
{
	struct tmfio	*xfinfo;
	tmfpblk_t	dmnc;

	xfinfo	= (struct tmfio *)fio->lyr_info;

	if (xfinfo->rwflag != READIN)
		return(0);

/*
 *	Discard any data in the buffer. Since this layer does
 *	not do any read-ahead, data would be in the buffer only
 *	if the user had read a partial record.
 */
	xfinfo->tmf_bufptr	= xfinfo->tmf_base;
	xfinfo->tmf_cnt		= 0;
/*
 *	Since we were just reading, we can't be at BOT.
 *      We must move the tape before we can write.  We will
 *      backspace then forwardspace.  A space of 0 doesn't work
 *	with traditional Irix support--I'm assuming it won't
 *	work with TMF either.
 */
	(void) memset(&dmnc, 0, sizeof(dmnc));

	dmnc.rh.length	= sizeof(tmfpblk_t) - sizeof(tmfreqhdr_t);
	dmnc.rh.request	= TR_PBLKS;
	dmnc.count	= -1;

	if (ioctl(xfinfo->tmf_fd, TMFC_DMNREQ, &dmnc) < 0) {
		ERETURN(stat, errno, 0);
	}
	if (dmnc.rh.reply != 0) {
		if ((dmnc.rh.reply != ETFMS) || (dmnc.rh.residual != 0))
			ERETURN(stat, dmnc.rh.reply, 0);
	}

	(void) memset(&dmnc, 0, sizeof(dmnc));

	dmnc.rh.length	= sizeof(tmfpblk_t) - sizeof(tmfreqhdr_t);
	dmnc.rh.request	= TR_PBLKS;
	dmnc.count	= 1;

	if (ioctl(xfinfo->tmf_fd, TMFC_DMNREQ, &dmnc) < 0) {
		ERETURN(stat, errno, 0);
	}
	if (dmnc.rh.reply != 0) {
		if ((dmnc.rh.reply != ETFMS) || (dmnc.rh.residual != 0))
			ERETURN(stat, dmnc.rh.reply, 0);
	}

	return(0);
}
Esempio n. 7
0
ssize_t
_sys_read(
struct fdinfo *fio, 
bitptr bufptr, 
size_t nbytes, 
struct ffsw *retstat,
int fulp, 
int *ubc)
	{
	ssize_t ret = 0;
	char *buf;

	buf = BPTR2CP(bufptr);
	if ((BPBITOFF(bufptr) & 7) != 0 || *ubc != 0)
		ERETURN(retstat, FDC_ERR_UBC, 0);
#ifdef __mips
        /*
         * If our last i/o was asynchronous, then our file position
         * won't be what we expect. Seek to the right position. We
         * could use a pread instead of seeking, but that would also
         * not update the file position. I'm doing this because it seems
         * to me most 'expected' for the system call layer.
         */
        if (((struct sys_f *)fio->lyr_info)->needpos) {
                if (lseek( fio->realfd, ((struct sys_f *)fio->lyr_info)->curpos,
                        0)  < 0)
                        ERETURN(retstat, errno, 0);
                ((struct sys_f *)fio->lyr_info)->needpos = 0;
        }
#endif

	if (nbytes > 0)
		{
		if (((struct sys_f *)fio->lyr_info)->nointrio)
			ret = read(fio->realfd, buf, nbytes);
		else {
			LOOP_SYSCALL(ret, read(fio->realfd, buf, nbytes));
		}
		if (ret < 0)
			ERETURN(retstat, errno, 0);
		}

	if (ret == 0 && nbytes > 0) {
		SETSTAT(retstat, FFEOD, ret);
	}
	else {
		SETSTAT(retstat, FFCNT, ret);
#ifdef __mips
		((struct sys_f *)(fio->lyr_info))->curpos += ret;
#endif
	}
	return (ret);
	}
Esempio n. 8
0
/***
	PUBLIC
	Metodo ClearMasks
	Deleta a lista de mascaras.


	Parameters:


	Return:
		- 0 se operacao OK ou negativo caso contrario.

	Comments:
		-

***/
int
LBSC_Base::ClearMasks()
{
	PRINTLOG( _clLBSLog, ("LBSC_Base::ClearMasks") );

	CLBAutoRegCrit	AutoRegCrit(&rcRegCrit);

	if( pltcMaskList ){
		int	iRet = pltcMaskList->LT_DelAllTerm();
		ERETURN( LBS_OK );
	}
	ERETURN( LBSE_NOMEMORY );
}
Esempio n. 9
0
int
_er90b_writea(struct fdinfo *fio, bitptr bufptr, int nbytes, 
	struct ffsw *retstat, int fulp, int *ubc)
{
int ret = 0;
char *buf;
ER90BYT *f;
int zero = 0;
struct ffsw dumstat;

	buf = BPTR2CP(bufptr);
	if ((BPBITOFF(bufptr) & 7) != 0 || *ubc != 0)
		ERETURN(retstat, FDC_ERR_UBC, 0);

	if (fio->rwflag == POSITIN) {
		f = (ER90BYT *)fio->lyr_info;
		if (f->tpos) {
			ret = _tape_tpwait(f->fd, &(f->tpos));
			if (ret < 0)
				ERETURN(retstat, errno, 0);
		}		
	}
	else if (fio->rwflag == READIN) {
		/* write after read requires position to zero */
		ret = _er90b_pos(fio, FP_RSEEK, &zero, 1,
			&dumstat);
		if (ret < 0) {
			*retstat = dumstat;
			return(ERR);
		}
	}

	if (nbytes > 0) {
		CLRFFSTAT(*retstat);	/* flag async in progress */
		ret=   writea(fio->realfd, buf, nbytes,
			(struct iosw *)retstat, 0);
		if (ret < 0)
			ERETURN(retstat, errno, 0);
	}
	else if (nbytes < 0) {
		ERETURN(retstat, FDC_ERR_REQ, 0);
	}
	else {	/* nbytes == 0 */
		retstat->sw_flag = 1;
		FFSTAT(*retstat) = FFCNT; /* I/O is done, and other stat */
					/* fields are already set. */
	}
	fio->rwflag = WRITIN;
	return (ret);
}
Esempio n. 10
0
off_t
#else
int
#endif
ffpos(
int fd,
int cmd,
#if	defined(__mips) || defined(_LITTLE_ENDIAN)
void *arg,
#else
long *arg,
#endif
int len,
struct ffsw *stat
)
	{
	struct fdinfo *fio;
	_ffseek_t ret;

	fio = GETIOB(fd);
	CHECK_FIOPTR(fio, stat);
#if	defined(__mips) || defined(_LITTLE_ENDIAN)
	if (cmd == FP_BSEEK)
		ERETURN(stat, FDC_ERR_NOSUP, 0);
#endif
	ret = XRCALL(fio, posrtn) fio, cmd, arg, len, stat);
	return (ret);
	}
Esempio n. 11
0
static ssize_t
_tmf_eovseen(
	struct tmfio	*xfinfo, 
	size_t		nbytes, 
	char		*dataptr,
	ssize_t		ret, 
	struct ffsw	*stat)
{
	xfinfo->tmf_eovhit	= 1;

	if (xfinfo->eovbuf == NULL) {
		xfinfo->eovbuf	= malloc(xfinfo->tmf_bufsiz);
		if (xfinfo->eovbuf == NULL) {
			ERETURN(stat,FDC_ERR_NOMEM, 0);
		}
		xfinfo->eovbase	= xfinfo->eovbuf;
	}
	if (ret < 0) {
		(void) memcpy(xfinfo->eovbuf, dataptr, nbytes);
		xfinfo->eovbytes	= nbytes;
		xfinfo->tmf_partblk	= 0;
	}
	else {
		(void) memcpy(xfinfo->eovbuf, dataptr + ret, nbytes - ret);
		xfinfo->eovbytes	= nbytes - ret;
		xfinfo->tmf_partblk	= 1;
	}
	xfinfo->tmf_cnt		= 0;
	xfinfo->tmf_bufptr	= xfinfo->tmf_base;
	SETSTAT(stat, FFEOR, nbytes);
	return(nbytes);
}
Esempio n. 12
0
int
_tmf_bksp(struct fdinfo *fio, struct ffsw *stat)
{
	struct tmfio	*xf_info;
	register int	ret;
	int		usertm;

	xf_info	= (struct tmfio *)fio->lyr_info;

	if (xf_info->tmf_tpos) {
		if (_tmf_tpwait (xf_info) < 0) {
			ERETURN(stat, errno, 0);
		}
	}
/*
 *	If the file's been writing, flush out any unwritten data.
 */
	if (xf_info->rwflag == WRITIN) {
		if (_tmf_flush(fio, stat) < 0) {
			return(ERR);
		}
	}
/*
 *	Now backspace.
 */	
	ret	= _tmf_stpos(fio, FP_TPOS_BACK, 1, 0, 0, 0, &usertm, stat);

	if (ret < 0 && stat->sw_error != ETBOF)
		return(ERR);

	xf_info->rwflag	= POSITIN;

	return(0);
}
Esempio n. 13
0
_ffseek_t
_ff_pos(
struct fdinfo	*fio,
int		cmd,
void		*argp,
int		len,
struct ffsw	*stat)
{
	int ret;
	long bytes;
	long *arg;
	arg = (long *)argp;

	switch (cmd) {
#if	!defined(__mips) && !defined(_LITTLE_ENDIAN)
	/* Before supporting this on MIPS, we need to look at what the */
	/* arguments should be. A long (for *arg) is not big enough */
	/* to hold the total file offset on 32-bit machines */
	case FP_BSEEK:
/*
 *		This should be changed someday to properly
 *		handle a bit position...
 */
		if ((*arg & 7) != 0)
			ERETURN(stat, FDC_ERR_BADSK, 0);
		if (*arg < 0) {
			bytes = (-(*arg))>>3;
			bytes = -bytes;
		}
		else
Esempio n. 14
0
ACL_CFG_LINE *acl_cfg_line_new(const char **value, int ncount)
{
	ACL_CFG_LINE *cfg_line = NULL;
	int   i;

#undef	ERETURN
#define	ERETURN(x) do { \
	if (cfg_line == NULL) \
		return (x); \
	if (cfg_line->value == NULL) { \
		acl_myfree(cfg_line); \
		return (x); \
	} \
	for (i = 0; i < cfg_line->ncount; i++) { \
		if (cfg_line->value[i] == NULL) \
			break; \
		acl_myfree(cfg_line->value[i]); \
	} \
	acl_myfree(cfg_line->value); \
	acl_myfree(cfg_line); \
	return (x); \
} while (0);

	if (value == NULL || ncount <= 0)
		return (NULL);

	cfg_line = (ACL_CFG_LINE *) acl_mycalloc(1, sizeof(ACL_CFG_LINE));
	if (cfg_line == NULL)
		return (NULL);

	cfg_line->value = (char **) acl_mycalloc(1 + ncount, sizeof(char *));
	if (cfg_line->value == NULL)
		ERETURN (NULL);

	cfg_line->pdata = NULL;
	cfg_line->ncount = 0;
	cfg_line->line_number = 0;

	for (i = 0; i < ncount; i++) {
		cfg_line->value[i] = acl_mystrdup(value[i]);
		if (cfg_line->value[i] == NULL)
			ERETURN (NULL);
		cfg_line->ncount++;
	}

	return (cfg_line);
}
Esempio n. 15
0
/***
	PUBLIC
	Metodo LoadMasks
	Carrega a lista de mascaras a partir de um arquivo.


	Parameters:
		- szFileName: nome do arquivo( inclusive path ).


	Return:
		- 0 se operacao OK ou negativo caso contrario.


	Comments:
        	-


***/
int
LBSC_Base::LoadMasks( char *szFileName )
{
	PRINTLOG( _clLBSLog, ("LBSC_Base::LoadMasks") );

	CLBAutoRegCrit	AutoRegCrit(&rcRegCrit);

	if( pltcMaskList ){
		pltcMaskList->LT_DelAllTerm();
		int	iRet = pltcMaskList->LT_LoadTermList( szFileName );
		if( iRet != OK ){
			pltcMaskList->LT_DelAllTerm();
			ERETURN( LBSE_ERROR );
		}
		ERETURN( LBS_OK );
	}
	ERETURN( LBSE_NOMEMORY );
}
Esempio n. 16
0
_er90b_lseek(struct fdinfo *fio, int pos, int whence, struct ffsw *stat)
{
int ret;

	if (whence == 0 && pos == 0) {
		ret = _er90b_rewd((ER90BYT *)fio->lyr_info);
		if (ret < 0)
			ERETURN(stat, errno, 0);
		fio->ateof = 0;
		fio->ateod = 0;
		SETSTAT(stat, FFBOD, 0);
	}
	else {
		ERETURN(stat, FDC_ERR_NOSUP, 0);
	}
	fio->rwflag = POSITIN;
	return (0);
}
Esempio n. 17
0
int
psbuf_get_8(struct puffs_framebuf *pb, uint64_t *val)
{
	int rv;

	rv = puffs_framebuf_getdata(pb, val, 8);
	BE64TOH(*val);

	ERETURN(rv);
}
Esempio n. 18
0
int
psbuf_get_4(struct puffs_framebuf *pb, uint32_t *val)
{
	int rv;

	rv = puffs_framebuf_getdata(pb, val, 4);
	BE32TOH(*val);

	ERETURN(rv);
}
Esempio n. 19
0
int
psbuf_get_2(struct puffs_framebuf *pb, uint16_t *val)
{
	int rv;

	rv = puffs_framebuf_getdata(pb, val, 2);
	BE16TOH(*val);

	ERETURN(rv);
}
Esempio n. 20
0
/***
	PUBLIC
	Metodo DeletePhone
	Deleta da lista de fonemas as definicoes desejadas. Estas definicoes
	deverao estar na string szPhoneArray separadas por um espaco em branco.


	Parameters:
		- szPhoneArray: String de caracteres, terminado com '\0', que
		contera as definicoes dos fonemas. Cada definicao (fonema) devera 
		estar separada por um caracter branco;


	Return:
		- 0 se operacao OK ou negativo caso contrario.

	Comments:
		-

***/
int
LBSC_Base::DeletePhone( char *szPhoneArray )
{
	PRINTLOG( _clLBSLog, ("LBSC_Base::DeletePhone") );

	CLBAutoRegCrit	AutoRegCrit(&rcRegCrit);

	LTC_TERMLIST	*pltcTermAux = new LTC_TERMLIST;
	if( !pltcTermAux ){
		ERETURN( LBSE_NOMEMORY );
	}

	if( !pltcPhone ){
		delete pltcTermAux;
		ERETURN( LBSE_NOMEMORY );
	}

	if( !plbscisIndexSystem ){
		delete pltcTermAux;
		ERETURN( LBSE_INVALIDINDEXSYSTEM );
	}

	if( pltcTermAux->LT_BuildTermList( szPhoneArray ) != LBS_OK ){
		delete pltcTermAux;
		SetError( pltcTermAux->GetError() );
		return( LBSE_ERROR );
	}

	int iRet = pltcPhone->LT_DeletePhone( pltcTermAux );

	if( iRet == 0 ){
		LTC_PHONE *pAux = plbscisIndexSystem->LT_SetPhone( pltcPhone );
		if( pAux ){
			delete pAux;
		}
		SetError( plbscisIndexSystem->GetError() );
	} else {
		SetError( pltcPhone->GetError() );
	}
	delete pltcTermAux;
	return( iRet );
}
Esempio n. 21
0
/***
	PUBLIC
	Metodo AddSynonym
	Adiciona um conjunto de sinonimos (szSynonymArray) para o termo ptctTerm

	Parameters:
		- szTerm: String de caracteres, terminado com '\0', indicando
		qual e o termo que possui o conjunto de sinonimos;
		- szSynonymArray: String de caracteres, terminado com '\0',
		que contera as diversas palavras que sao sinonimos do termo
		passado como parametro. As palavras desta string deverao estar
		separadas por um caracter branco;
		- iFlag: Flag indicativo para a utilizacao, ou nao, de
		bidirecionamento ou associatividade.

	Return:
		- 0 se operacao OK ou negativo caso contrario.

	Comments:
		-

***/
int
LBSC_Base::AddSynonym( char *szTerm, char *szSynonymArray, int iFlag )
{
	PRINTLOG( _clLBSLog, ("LBSC_Base::AddSynonym") );

	CLBAutoRegCrit	AutoRegCrit(&rcRegCrit);

	LTC_TERMLIST	*pltcTermAux = new LTC_TERMLIST;
	if( !pltcTermAux ){
		ERETURN( LBSE_NOMEMORY );
	}

	if( !pltcSynonym ){
		delete pltcTermAux;
		ERETURN( LBSE_NOMEMORY );
	}

	if( !plbscisIndexSystem ){
		delete pltcTermAux;
		ERETURN( LBSE_INVALIDINDEXSYSTEM );
	}

	if( pltcTermAux->LT_BuildTermList( szSynonymArray ) != LBS_OK ){
		SetError( pltcTermAux->GetError() );
		delete pltcTermAux;
		return( LBSE_ERROR );
	}

	int iRet = pltcSynonym->LT_AddSynonym( szTerm, pltcTermAux, iFlag );

	if( iRet == 0 ){
		LTC_SYNONYM *pAux = plbscisIndexSystem->LT_SetSynonym( pltcSynonym );
		if( pAux ){
			delete pAux;
		}
		SetError( plbscisIndexSystem->GetError() );
	} else {
		SetError( pltcSynonym->GetError() );
	}
	delete pltcTermAux;
	return( iRet );
}
Esempio n. 22
0
static int nr_ice_crypto_openssl_hmac_sha1(UCHAR *key, int key_l, UCHAR *buf, int buf_l, UCHAR digest[20]) {
  unsigned int rl;

  HMAC(EVP_sha1(),
    key, key_l, buf, buf_l, digest, &rl);

  if (rl != 20)
    ERETURN(R_INTERNAL);

  return 0;
}
Esempio n. 23
0
/***
	PUBLIC
	Metodo OLNot
	Faz um batimento NOT entre duas listas de ocorrencias
        e gera uma terceira lista

	Parameters:
		- lbscTicket : o ticket de seguranca
		- iHandle1 : handle da primeira LO
		- iHandle2 : handle da segunda LO

	Return:
		- o handle da LO gerada ou um erro (valor negativo)

	Comments:
        	- a LO gerada NAO se torna a corrente
                  (ela nao eh habilitada)

***/
int
LBSC_Base::OLNot( const LBSC_Ticket *lbscTicket, int iHandle1, int iHandle2 )
{
	PRINTLOG( _clLBSLog, ("LBSC_Base::OLNot") );

	CLBAutoRegCrit	AutoRegCrit(&rcRegCrit);

	if( plbscsOwnerSession->TicketIsOk( lbscTicket ) != 0 ){
		ERETURN( LBSE_TICKETNOTOK );
	}
	return( LogicalOp( OL_NOT, iHandle1, iHandle2 ) );
}
Esempio n. 24
0
/**********************************************************
// Function name	: LBSC_Session::ValidUser
// Description	    : 
// Return type		: int 
// Argument         :  const LBSC_Ticket *plbscTicketPar
// Argument         : const char *szUserName
// Argument         : const char *szPassword
**********************************************************/
int LBSC_Session::ValidUser( const LBSC_Ticket *plbscTicketPar, const char *szUserName, const char *szPassword )
{
	PRINTLOG( _clLBSLog, ("LBSC_Session::ValidUser") );

	// Verifica a validade do ticket de seguranca
	if( TicketIsOk( plbscTicketPar ) != 0 ){
		ERETURN( LBSE_TICKETNOTOK );
	}
	// Abrir a UDB
	LBSC_Base	*pUdb = new LBSC_Base( plbscTicketPar, (char*) strUDBLogged, this );
	if( !pUdb ){
		ERETURN( LBSE_NOMEMORY );
	}
	if( !pUdb->BaseObjOk() ){
		delete pUdb;
		ERETURN( LBSE_UBNOTOK );
	}
	int iRet = FindUser( pUdb, szUserName, szPassword );
	delete pUdb;
	ERETURN( iRet );	
}
Esempio n. 25
0
/*
 * This routine is like ffopen, except it expects all parameters
 */
ffopenf(const char *name, int flags, mode_t mode, long cbits, int cblks,
	struct ffsw *pstat)
{
	int		narg;
	_ffopen_t	fd;
	int		retfd;
	int		aifound;
	union spec_u	*fdspec;
	struct gl_o_inf	gloinf;
	assign_info	ai;
	struct fdinfo	*nfio;

	extern union spec_u *_g_fdc_spec();

 	aifound = _assign_asgcmd_info(name, -1, ASN_G_FF | ASN_G_ALL, &ai,
			NULL, 1);
	if (aifound == -1) {
		ERETURN(pstat, errno, 0);
	}

	if (aifound == 1 && ai.F_filter_flg)
		fdspec = &ai.F_filter[0];
	else
		fdspec = NULL;

	(void) memset(&gloinf, 0, sizeof(gloinf));
        gloinf.aip	= aifound ? &ai : NULL;

	fd = _ffopen(name, flags, mode, fdspec, pstat, cbits, cblks, NULL,
		&gloinf);

#if defined(_CRAY1) || defined(__mips)
	if (fd != _FFOPEN_ERR && MULTI_ON) {
		nfio = NULL;
		if (_ff_top_lock(fd, &nfio, pstat) < 0)
			fd = _FFOPEN_ERR;
		if (nfio != NULL)
			fd = (_ffopen_t)nfio;
	}
#endif
	/*
	 * ffopen returns an int. Call a routine which associates an
	 * int with what is returned by _ffopen 
	 */
#if	defined(__mips) || defined(_LITTLE_ENDIAN)
	retfd = _ff_fdinfo_to_int(fd, pstat);
#else
	retfd = (int)fd;
#endif
	/* should check chain of layers here for sanity */

	return(retfd);
}
Esempio n. 26
0
/***
	PUBLIC
	Metodo SetMask
	Define um conjunto de mascaras de reconhecimento de termos que poderao
	ser indexados como data, hora e valor. Esta definicao e feita por sistema
	de indices

	Parameters:
		- szMasks: Apontador para uma cadeia de caracteres com a
		lista de mascaras que sera setado como lista de mascara
		corrente de um determinado sistema de indices;
		- iIndex: Informa para qual indice a lista de mascaras esta
		sendo setada. Podera ser para o indice de Data (DATETREE),
		Hora (TIMETREE) ou Valor (VALUETREE).
		- iTypeOfHeaderMask: Representa o tipo de mascara que deve ser
		settada em função da lingua do produto: Portugues  valor 1 ou 
		Ingles valor 0.

	Return:
		- LBS_OK se conseguir setar ou erro.

	Comments:
        	-

***/
int
LBSC_Base::SetMask( char *szMasks, int iIndex, int iTypeOfHeaderMask )
{
	PRINTLOG( _clLBSLog, ("LBSC_Base::SetMask") );

	CLBAutoRegCrit	AutoRegCrit(&rcRegCrit);

	if( !plbscisIndexSystem ){
		ERETURN( LBSE_INVALIDINDEXSYSTEM );
	}
	if( (iIndex != DATETREE) && (iIndex != TIMETREE) && (iIndex != VALUETREE) ){
		ERETURN( LBSE_INVALIDINDEXTYPE );
	}
	if( !pltcMaskList || pltcMaskList->LT_BuildTermList( szMasks ) != LBS_OK ){
		ERETURN( LBSE_ERROR );
	}
	LTC_TERMLIST *pAux = plbscisIndexSystem->LT_SetMask( pltcMaskList, iIndex, iTypeOfHeaderMask );
	if( pAux ){
		delete pAux;
	}
	ERETURN( LBS_OK );
}
Esempio n. 27
0
/***
	PUBLIC
	Metodo LoadSynonym
	Carrega um objeto LTC_SYNONYM armazenado em arquivo, lendo os termos
	e seus sinonimos que serao adicionados no objeto .


	Parameters:
		-szFileName: nome do arquivo.


	Return:
		- 0 se operacao OK ou negativo caso contrario.

	Comments:
        	-

***/
int
LBSC_Base::LoadSynonym( char *szFileName )
{
	PRINTLOG( _clLBSLog, ("LBSC_Base::LoadSynonym") );

	CLBAutoRegCrit	AutoRegCrit(&rcRegCrit);

	if( pltcSynonym ){
		int	iRet = pltcSynonym->LT_LoadSynonym( szFileName );
		SetError( pltcSynonym->GetError() );
		return( iRet );
	}
	ERETURN( LBSE_NOMEMORY );
}
Esempio n. 28
0
/*
 * lock listio requests
 * The lock layer will be called only if the lower layer can handle listio 
 * requests.
 */
_lock_listio(
int			cmd,		/* LC_WAIT or LC_START */
struct fflistreq	*list,		/* list of requests (see fflistio) */
int			nreq,		/* number of requests */
struct ffsw		*stat)		/* status structure */
{

	int	i;
	struct fdinfo	*llfio;
	struct fdinfo	*first_fio;
	struct fdinfo	*fio;
	struct fflistreq *copy;		/* copy of the list of requests */
	int	numdone;
	int	curent;
	int	pos;
	bitptr	buf;
	int	nb;
	int	zero;
	int	ret;
	int	nstr;
	struct ffsw	locstat;
	struct ffsw	 *istat;

	if (nreq == 0)
		return(0);
	first_fio = GETIOB(list[0].li_fildes);
	for (i = 0; i < nreq; i++) {
		fio = GETIOB(list[i].li_fildes);
		if (fio != first_fio) {
			_SETERROR(stat, FDC_ERR_LSTIO, 0);
			return (-1);
		}
	}

	llfio = first_fio->fioptr;
	if (llfio->can_listio) {
		copy = malloc(nreq * sizeof(*list));
		if (copy == NULL)
			ERETURN(stat, FDC_ERR_NOMEM, 0);

		for (i = 0; i < nreq; i++) {
			copy[i] = list[i];		/* copy the entry */
			copy[i].li_fildes = (int)llfio;	
		}
		LYR_LOCK(fio);
		numdone = XRCALL(llfio, listiortn) cmd, copy, nreq, stat);
		LYR_UNLOCK(fio);
		free(copy);
		return(numdone);
	}
Esempio n. 29
0
/***
	PUBLIC
	Metodo FindPhone
	Realiza uma pesquisa fonetica de um termo. Recebe um termo (ptctTerm)
	com parametro e devolve o numero fonetico correspondente a este termo.


	Parameters:
		- szTerm: termo;
		- szPhoneValue: 


	Return:
		- 0 se operacao OK ou negativo caso contrario.

	Comments:
		-

***/
int
LBSC_Base::FindPhone( char *szTerm, char *szPhoneValue )
{
	PRINTLOG( _clLBSLog, ("LBSC_Base::FindPhone") );

	CLBAutoRegCrit	AutoRegCrit(&rcRegCrit);

	if( pltcPhone ){
		int	iRet = pltcPhone->LT_FindPhone( szTerm, szPhoneValue );
		SetError( pltcPhone->GetError() );
		return( iRet );
	}
	ERETURN( LBSE_NOMEMORY );
}
Esempio n. 30
0
/***
	PUBLIC
	Metodo SavePhone
	Salva em arquivo o conteudo de um objeto LTC_PHONE, gravando os
	fonemas contidos neste objeto. 


	Parameters:
		- szFileName: nome do arquivo (inclusive path).


	Return:
		- 0 se operacao OK ou negativo caso contrario.

	Comments:
        	-


***/
int
LBSC_Base::SavePhone( char *szFileName )
{
	PRINTLOG( _clLBSLog, ("LBSC_Base::SavePhone") );

	CLBAutoRegCrit	AutoRegCrit(&rcRegCrit);

	if( pltcPhone ){
		int	iRet = pltcPhone->LT_SavePhone( szFileName );
		SetError( pltcPhone->GetError() );
		return( iRet );
	}
	ERETURN( LBSE_NOMEMORY );
}