本文整理汇总了C++中sdr_begin_xn函数的典型用法代码示例。如果您正苦于以下问题:C++ sdr_begin_xn函数的具体用法?C++ sdr_begin_xn怎么用?C++ sdr_begin_xn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sdr_begin_xn函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: executeList
static void executeList(int tokenCount, char **tokens)
{
Sdr sdr = getIonsdr();
PsmPartition ionwm = getIonwm();
IonVdb *vdb = getIonVdb();
PsmAddress elt;
PsmAddress addr;
char buffer[RFX_NOTE_LEN];
if (tokenCount < 2)
{
printText("List what?");
return;
}
if (strcmp(tokens[1], "contact") == 0)
{
CHKVOID(sdr_begin_xn(sdr));
for (elt = sm_rbt_first(ionwm, vdb->contactIndex); elt;
elt = sm_rbt_next(ionwm, elt))
{
addr = sm_rbt_data(ionwm, elt);
rfx_print_contact(addr, buffer);
printText(buffer);
}
sdr_exit_xn(sdr);
return;
}
if (strcmp(tokens[1], "range") == 0)
{
CHKVOID(sdr_begin_xn(sdr));
for (elt = sm_rbt_first(ionwm, vdb->rangeIndex); elt;
elt = sm_rbt_next(ionwm, elt))
{
addr = sm_rbt_data(ionwm, elt);
rfx_print_range(addr, buffer);
printText(buffer);
}
sdr_exit_xn(sdr);
return;
}
SYNTAX_ERROR;
}
开发者ID:michirod,项目名称:cgr-jni,代码行数:47,代码来源:ionadmin.c
示例17: applyRateControl
static void applyRateControl(Sdr sdr)
{
BpVdb *vdb = getBpVdb();
PsmPartition ionwm = getIonwm();
Throttle *throttle;
PsmAddress elt;
VInduct *induct;
VOutduct *outduct;
long capacityLimit;
sdr_begin_xn(sdr); /* Just to lock memory. */
/* Recalculate limit on local bundle generation. */
manageProductionThrottle(vdb);
/* Enable some bundle acquisition. */
for (elt = sm_list_first(ionwm, vdb->inducts); elt;
elt = sm_list_next(ionwm, elt))
{
induct = (VInduct *) psp(ionwm, sm_list_data(ionwm, elt));
throttle = &(induct->acqThrottle);
capacityLimit = throttle->nominalRate << 1;
throttle->capacity += throttle->nominalRate;
if (throttle->capacity > capacityLimit)
{
throttle->capacity = capacityLimit;
}
if (throttle->capacity > 0)
{
sm_SemGive(throttle->semaphore);
}
}
/* Enable some bundle transmission. */
for (elt = sm_list_first(ionwm, vdb->outducts); elt;
elt = sm_list_next(ionwm, elt))
{
outduct = (VOutduct *) psp(ionwm, sm_list_data(ionwm, elt));
throttle = &(outduct->xmitThrottle);
capacityLimit = throttle->nominalRate << 1;
throttle->capacity += throttle->nominalRate;
if (throttle->capacity > capacityLimit)
{
throttle->capacity = capacityLimit;
}
if (throttle->capacity > 0)
{
sm_SemGive(throttle->semaphore);
}
}
sdr_exit_xn(sdr); /* Unlock memory. */
}
开发者ID:b,项目名称:ION,代码行数:58,代码来源:bpclock.c
示例18: updateMinimumCustodyId
int updateMinimumCustodyId(unsigned int minimumCustodyId)
{
CHKERR(sdr_begin_xn(acsSdr));
sdr_poke(acsSdr, acsConstants->id, minimumCustodyId);
if(sdr_end_xn(acsSdr) < 0)
{
ACSLOG_ERROR("Couldn't update minimum custody ID to %u", minimumCustodyId);
return -1;
}
return 0;
}
开发者ID:raonyguimaraes,项目名称:pleiades-DTN,代码行数:11,代码来源:acstx.c
示例19: dtn2_updateRule
int dtn2_updateRule(char *nodeNm, char *demux, FwdDirective *directive)
{
Sdr sdr = getIonsdr();
char nodeName[SDRSTRING_BUFSZ];
Object elt;
OBJ_POINTER(Dtn2Plan, plan);
Object ruleAddr;
Dtn2Rule ruleBuf;
CHKERR(nodeNm && demux && directive);
if (*demux == '\0')
{
writeMemo("[?] Zero-length DTN2 rule demux.");
return 0;
}
if (filterNodeName(nodeName, nodeNm) < 0)
{
return 0;
}
CHKERR(sdr_begin_xn(sdr));
elt = locatePlan(nodeName, NULL);
if (elt == 0)
{
sdr_exit_xn(sdr);
writeMemoNote("[?] No plan defined for this node", nodeNm);
return 0;
}
GET_OBJ_POINTER(sdr, Dtn2Plan, plan, sdr_list_data(sdr, elt));
dtn2_findRule(nodeName, demux, plan, &ruleAddr, &elt);
if (elt == 0)
{
sdr_exit_xn(sdr);
writeMemoNote("[?] Unknown rule", demux);
return 0;
}
/* All parameters validated, okay to update the rule. */
sdr_stage(sdr, (char *) &ruleBuf, ruleAddr, sizeof(Dtn2Rule));
dtn2_destroyDirective(&ruleBuf.directive);
memcpy((char *) &ruleBuf.directive, (char *) directive,
sizeof(FwdDirective));
sdr_write(sdr, ruleAddr, (char *) &ruleBuf, sizeof(Dtn2Rule));
if (sdr_end_xn(sdr) < 0)
{
putErrmsg("Can't update rule.", NULL);
return -1;
}
return 1;
}
开发者ID:brnrc,项目名称:ion-dtn,代码行数:54,代码来源:libdtn2fw.c
示例20: dtn2_removeRule
int dtn2_removeRule(char *nodeNm, char *demux)
{
Sdr sdr = getIonsdr();
char nodeName[SDRSTRING_BUFSZ];
Object elt;
OBJ_POINTER(Dtn2Plan, plan);
Object ruleAddr;
OBJ_POINTER(Dtn2Rule, rule);
CHKERR(nodeNm && demux);
if (*demux == '\0')
{
writeMemo("[?] Zero-length DTN2 rule demux.");
return 0;
}
if (filterNodeName(nodeName, nodeNm) < 0)
{
return 0;
}
CHKERR(sdr_begin_xn(sdr));
elt = locatePlan(nodeName, NULL);
if (elt == 0)
{
sdr_exit_xn(sdr);
writeMemoNote("[?] No plan defined for this node", nodeNm);
return 0;
}
GET_OBJ_POINTER(sdr, Dtn2Plan, plan, sdr_list_data(sdr, elt));
dtn2_findRule(nodeName, demux, plan, &ruleAddr, &elt);
if (elt == 0)
{
sdr_exit_xn(sdr);
writeMemoNote("[?] Unknown rule", demux);
return 0;
}
/* All parameters validated, okay to remove the rule. */
GET_OBJ_POINTER(sdr, Dtn2Rule, rule, ruleAddr);
dtn2_destroyDirective(&(rule->directive));
sdr_free(sdr, ruleAddr);
sdr_list_delete(sdr, elt, NULL, NULL);
if (sdr_end_xn(sdr) < 0)
{
putErrmsg("Can't remove rule.", NULL);
return -1;
}
return 1;
}
开发者ID:brnrc,项目名称:ion-dtn,代码行数:53,代码来源:libdtn2fw.c
注:本文中的sdr_begin_xn函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论