当前位置: 首页>>代码示例>>C++>>正文


C++ sdr_begin_xn函数代码示例

本文整理汇总了C++中sdr_begin_xn函数的典型用法代码示例。如果您正苦于以下问题:C++ sdr_begin_xn函数的具体用法?C++ sdr_begin_xn怎么用?C++ sdr_begin_xn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了sdr_begin_xn函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: dtn2_destroyDirective

void	dtn2_destroyDirective(FwdDirective *directive)
{
	Sdr	sdr = getIonsdr();

	CHKVOID(directive);
	if (directive->action == fwd)
	{
		CHKVOID(sdr_begin_xn(sdr));
		sdr_free(sdr, directive->eid);
		if (sdr_end_xn(sdr) < 0)
		{
			putErrmsg("Can't destroy directive EID.", NULL);
		}

		return;
	}

	if (directive->action == xmit)
	{
		if (directive->destDuctName)
		{
			CHKVOID(sdr_begin_xn(sdr));
			sdr_free(sdr, directive->destDuctName);
			if (sdr_end_xn(sdr) < 0)
			{
				putErrmsg("Can't destroy destDuctName.", NULL);
			}

		}
	}
}
开发者ID:brnrc,项目名称:ion-dtn,代码行数:31,代码来源:libdtn2fw.c

示例2: ionAppendZcoExtent

vast	ionAppendZcoExtent(Object zco, ZcoMedium source, Object location,
		vast offset, vast size, int *cancel)
{
	Sdr	sdr = getIonsdr();
	IonVdb	*vdb = _ionvdb(NULL);
	Object	length;
	int	admissionDelayed = 0;

	CHKZERO(vdb);
	if (cancel)
	{
		*cancel = 0;		/*	Initialize.		*/
	}

	CHKZERO(sdr_begin_xn(sdr));
	while (1)
	{
		length = zco_append_extent(sdr, zco, source, location, offset,
				size);
		if (sdr_end_xn(sdr) < 0 || length == ERROR)
		{
			putErrmsg("Can't create ZCO.", NULL);
			return ERROR;
		}

		if (length == 0)	/*	Not enough ZCO space.	*/
		{
			if (admissionDelayed)
			{
				ionReleaseZcoSpace(vdb);
			}

			admissionDelayed = 1;
			if (ionWaitForZcoSpace(vdb) == 1)
			{
				if (cancel && *cancel)
				{
					return 0;
				}

				CHKZERO(sdr_begin_xn(sdr));
				continue;
			}

			return ERROR;
		}

		/*	ZCO extent was appended.			*/

		if (admissionDelayed)
		{
			ionReleaseZcoSpace(vdb);
		}

		return length;
	}
}
开发者ID:pantuza,项目名称:pleiades-DTN,代码行数:57,代码来源:ion.c

示例3: ionCreateZco

Object	ionCreateZco(ZcoMedium source, Object location, vast offset, vast size,
		int *cancel)
{
	Sdr	sdr = getIonsdr();
	IonVdb	*vdb = _ionvdb(NULL);
	Object	zco;
	int	admissionDelayed = 0;

	CHKZERO(vdb);
	if (cancel)
	{
		*cancel = 0;		/*	Initialize.		*/
	}

	CHKZERO(sdr_begin_xn(sdr));
	while (1)
	{
		zco = zco_create(sdr, source, location, offset, size);
		if (sdr_end_xn(sdr) < 0 || zco == (Object) ERROR)
		{
			putErrmsg("Can't create ZCO.", NULL);
			return 0;
		}

		if (zco == 0)	/*	Not enough ZCO space.		*/
		{
			if (admissionDelayed)
			{
				ionReleaseZcoSpace(vdb);
			}

			admissionDelayed = 1;
			if (ionWaitForZcoSpace(vdb) == 1)
			{
				if (cancel && *cancel)
				{
					return 0;
				}

				CHKZERO(sdr_begin_xn(sdr));
				continue;
			}

			return 0;
		}

		/*	ZCO was created.				*/

		if (admissionDelayed)
		{
			ionReleaseZcoSpace(vdb);
		}

		return zco;
	}
}
开发者ID:pantuza,项目名称:pleiades-DTN,代码行数:56,代码来源:ion.c

示例4: manageMtusize

static void	manageMtusize(int tokenCount, char **tokens)
{
	Sdr	sdr = getIonsdr();
	Object	cfdpdbObj = getCfdpDbObject();
	CfdpDB	cfdpdb;
	int	newMtusize;

	if (tokenCount != 3)
	{
		SYNTAX_ERROR;
	}

	newMtusize = atoi(tokens[2]);
	if (newMtusize < 0)
	{
		putErrmsg("mtuSize invalid.", tokens[2]);
		return;
	}

	sdr_begin_xn(sdr);
	sdr_stage(sdr, (char *) &cfdpdb, cfdpdbObj, sizeof(CfdpDB));
	cfdpdb.mtuSize = newMtusize;
	sdr_write(sdr, cfdpdbObj, (char *) &cfdpdb, sizeof(CfdpDB));
	if (sdr_end_xn(sdr) < 0)
	{
		putErrmsg("Can't change mtuSize.", NULL);
	}
}
开发者ID:b,项目名称:ION,代码行数:28,代码来源:cfdpadmin.c

示例5: getOrMakeCustodianByEid

Object getOrMakeCustodianByEid(Object custodians, const char *eid)
{
    Object custodianAddr;

    /* Try to find custodian info if it exists. */
    CHKZERO(sdr_begin_xn(acsSdr));
    custodianAddr = findCustodianByEid(custodians, eid);
    if(sdr_end_xn(acsSdr) < 0)
    {
        putErrmsg("Can't search custodian database", eid);
        return 0;
    }

    /* If no custodian info, make it. */
    if(custodianAddr == 0)
    {
        custodianAddr = newSdrAcsCustodian(custodians, eid);
        if(custodianAddr == 0)
        {
            ACSLOG_WARN("Couldn't record new custodian info for %s", eid);
            return 0;
        }
    }
    return custodianAddr;
}
开发者ID:raonyguimaraes,项目名称:pleiades-DTN,代码行数:25,代码来源:acstx.c

示例6: bp_release_delivery

void	bp_release_delivery(BpDelivery *dlvBuffer, int releasePayload)
{
	Sdr	sdr = getIonsdr();

	CHKVOID(dlvBuffer);
	if (dlvBuffer->result == BpPayloadPresent)
	{
		if (dlvBuffer->bundleSourceEid)
		{
			MRELEASE(dlvBuffer->bundleSourceEid);
			dlvBuffer->bundleSourceEid = NULL;
		}

		if (releasePayload)
		{
			if (dlvBuffer->adu)
			{
				sdr_begin_xn(sdr);
				zco_destroy_reference(sdr, dlvBuffer->adu);
				if (sdr_end_xn(sdr) < 0)
				{
					putErrmsg("Failed releasing delivery.",
							NULL);
				}

				dlvBuffer->adu = 0;
			}
		}
	}
}
开发者ID:b,项目名称:ION,代码行数:30,代码来源:libbp.c

示例7: getIonsdr

static DtnDB	*_dtn2Constants()
{
	static DtnDB	buf;
	static DtnDB	*db = NULL;
	Sdr		sdr;
	Object		dbObject;
	
	if (db == NULL)
	{
		sdr = getIonsdr();
		CHKNULL(sdr);
		dbObject = _dtn2dbObject(NULL);
		if (dbObject)
		{
			if (sdr_heap_is_halted(sdr))
			{
				sdr_read(sdr, (char *) &buf, dbObject,
						sizeof(DtnDB));
			}
			else
			{
				CHKNULL(sdr_begin_xn(sdr));
				sdr_read(sdr, (char *) &buf, dbObject,
						sizeof(DtnDB));
				sdr_exit_xn(sdr);
			}

			db = &buf;
		}
	}
	
	return db;
}
开发者ID:brnrc,项目名称:ion-dtn,代码行数:33,代码来源:libdtn2fw.c

示例8: manageMaxtrnbr

static void	manageMaxtrnbr(int tokenCount, char **tokens)
{
	Sdr	sdr = getIonsdr();
	Object	cfdpdbObj = getCfdpDbObject();
	CfdpDB	cfdpdb;
	int	newMaxtrnbr;

	if (tokenCount != 3)
	{
		SYNTAX_ERROR;
	}

	newMaxtrnbr = atoi(tokens[2]);
	if (newMaxtrnbr < 0)
	{
		putErrmsg("maxTransactionNbr invalid.", tokens[2]);
		return;
	}

	sdr_begin_xn(sdr);
	sdr_stage(sdr, (char *) &cfdpdb, cfdpdbObj, sizeof(CfdpDB));
	cfdpdb.maxTransactionNbr = newMaxtrnbr;
	sdr_write(sdr, cfdpdbObj, (char *) &cfdpdb, sizeof(CfdpDB));
	if (sdr_end_xn(sdr) < 0)
	{
		putErrmsg("Can't change maxTransactionNbr.", NULL);
	}
}
开发者ID:b,项目名称:ION,代码行数:28,代码来源:cfdpadmin.c

示例9: acsAttach

int acsAttach()
{
    if (acsConstants)
    {
        return 0;
    }

    if (getAcssdr() == NULL)
    {
        /* ACS can't find ACS SDR. */
        return -1;
    }

    CHKERR(sdr_begin_xn(acsSdr));
    if (acsdbObject == 0)
    {
        acsdbObject = sdr_find(acsSdr, acsDbName, NULL);
        if (acsdbObject == 0)
        {
            sdr_exit_xn(acsSdr);
            return -1;
        }
    }
    acsConstants = &acsConstantsBuf;
    sdr_read(acsSdr, (char *) acsConstants, acsdbObject, sizeof(AcsDB));
    sdr_exit_xn(acsSdr);
    return 0;
}
开发者ID:raonyguimaraes,项目名称:pleiades-DTN,代码行数:28,代码来源:acstx.c

示例10: manageFillchar

static void	manageFillchar(int tokenCount, char **tokens)
{
	Sdr	sdr = getIonsdr();
	Object	cfdpdbObj = getCfdpDbObject();
	CfdpDB	cfdpdb;
	int	newFillchar;
	char	*trailing;

	if (tokenCount != 3)
	{
		SYNTAX_ERROR;
	}

	newFillchar = strtol(tokens[2], &trailing, 16);
	if (*trailing != '\0')
	{
		putErrmsg("fillCharacter invalid.", tokens[2]);
		return;
	}

	sdr_begin_xn(sdr);
	sdr_stage(sdr, (char *) &cfdpdb, cfdpdbObj, sizeof(CfdpDB));
	cfdpdb.fillCharacter = newFillchar;
	sdr_write(sdr, cfdpdbObj, (char *) &cfdpdb, sizeof(CfdpDB));
	if (sdr_end_xn(sdr) < 0)
	{
		putErrmsg("Can't change fillCharacter.", NULL);
	}
}
开发者ID:b,项目名称:ION,代码行数:29,代码来源:cfdpadmin.c

示例11: manageMaxtimeouts

static void	manageMaxtimeouts(int tokenCount, char **tokens)
{
	Sdr	sdr = getIonsdr();
	Object	cfdpdbObj = getCfdpDbObject();
	CfdpDB	cfdpdb;
	int	newMaxtimeouts;

	if (tokenCount != 3)
	{
		SYNTAX_ERROR;
	}

	newMaxtimeouts = atoi(tokens[2]);
	if (newMaxtimeouts < 0)
	{
		putErrmsg("checkTimeoutLimit invalid.", tokens[2]);
		return;
	}

	sdr_begin_xn(sdr);
	sdr_stage(sdr, (char *) &cfdpdb, cfdpdbObj, sizeof(CfdpDB));
	cfdpdb.checkTimeoutLimit = newMaxtimeouts;
	sdr_write(sdr, cfdpdbObj, (char *) &cfdpdb, sizeof(CfdpDB));
	if (sdr_end_xn(sdr) < 0)
	{
		putErrmsg("Can't change checkTimerPeriod.", NULL);
	}
}
开发者ID:b,项目名称:ION,代码行数:28,代码来源:cfdpadmin.c

示例12: manageRequirecrc

static void	manageRequirecrc(int tokenCount, char **tokens)
{
	Sdr	sdr = getIonsdr();
	Object	cfdpdbObj = getCfdpDbObject();
	CfdpDB	cfdpdb;
	int	newRequirecrc;

	if (tokenCount != 3)
	{
		SYNTAX_ERROR;
	}

	newRequirecrc = atoi(tokens[2]);
	if (newRequirecrc != 0 && newRequirecrc != 1)
	{
		putErrmsg("crcRequired switch invalid.", tokens[2]);
		return;
	}

	sdr_begin_xn(sdr);
	sdr_stage(sdr, (char *) &cfdpdb, cfdpdbObj, sizeof(CfdpDB));
	cfdpdb.crcRequired = newRequirecrc;
	sdr_write(sdr, cfdpdbObj, (char *) &cfdpdb, sizeof(CfdpDB));
	if (sdr_end_xn(sdr) < 0)
	{
		putErrmsg("Can't change crcRequired switch.", NULL);
	}
}
开发者ID:b,项目名称:ION,代码行数:28,代码来源:cfdpadmin.c

示例13: manageDiscard

static void	manageDiscard(int tokenCount, char **tokens)
{
	Sdr	sdr = getIonsdr();
	Object	cfdpdbObj = getCfdpDbObject();
	CfdpDB	cfdpdb;
	int	newDiscard;

	if (tokenCount != 3)
	{
		SYNTAX_ERROR;
	}

	newDiscard = atoi(tokens[2]);
	if (newDiscard != 0 && newDiscard != 1)
	{
		putErrmsg("discardIncompleteFile switch invalid.", tokens[2]);
		return;
	}

	sdr_begin_xn(sdr);
	sdr_stage(sdr, (char *) &cfdpdb, cfdpdbObj, sizeof(CfdpDB));
	cfdpdb.discardIncompleteFile = newDiscard;
	sdr_write(sdr, cfdpdbObj, (char *) &cfdpdb, sizeof(CfdpDB));
	if (sdr_end_xn(sdr) < 0)
	{
		putErrmsg("Can't change discardIncompleteFile switch.", NULL);
	}
}
开发者ID:b,项目名称:ION,代码行数:28,代码来源:cfdpadmin.c

示例14: reforwardStrandedBundles

static int	reforwardStrandedBundles()
{
	Sdr	sdr = getIonsdr();
	BpDB	*bpConstants = getBpConstants();
	Object	elt;
	Object	nextElt;

	CHKERR(sdr_begin_xn(sdr));
	for (elt = sdr_list_first(sdr, bpConstants->limboQueue); elt;
			elt = nextElt)
	{
		nextElt = sdr_list_next(sdr, elt);
		if (releaseFromLimbo(elt, 0) < 0)
		{
			putErrmsg("Failed releasing bundle from limbo.", NULL);
			sdr_cancel_xn(sdr);
			return -1;
		}
	}

	if (sdr_end_xn(sdr) < 0)
	{
		putErrmsg("brss failed limbo release on client connect.", NULL);
		return -1;
	}

	return 0;
}
开发者ID:brnrc,项目名称:ion-dtn,代码行数:28,代码来源:brsscla.c

示例15: newSdrAcsCustodian

static Object newSdrAcsCustodian(Object custodians, const char *eid)
{
    Object newCustodianAddr;
    SdrAcsPendingCust newCustodian;

    memset(&newCustodian, 0, sizeof(newCustodian));
    strncpy(newCustodian.eid, eid, MAX_EID_LEN);
    newCustodian.eid[MAX_EID_LEN] = '\0';

    /* Set default ACS size and delay. */
    newCustodian.acsDelay = 2;
    newCustodian.acsSize = 300;

    CHKZERO(sdr_begin_xn(acsSdr));
    newCustodianAddr = sdr_malloc(acsSdr, sizeof(newCustodian));
    newCustodian.signals = sdr_list_create(acsSdr);
    sdr_poke(acsSdr, newCustodianAddr, newCustodian);
    sdr_list_insert_last(acsSdr, custodians, newCustodianAddr);
    if(sdr_end_xn(acsSdr) < 0)
    {
        ACSLOG_WARN("Couldn't create new custodian info for %s", eid);
        return 0;
    }
    return newCustodianAddr;
}
开发者ID:raonyguimaraes,项目名称:pleiades-DTN,代码行数:25,代码来源:acstx.c


注:本文中的sdr_begin_xn函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。