本文整理汇总了C++中printd函数的典型用法代码示例。如果您正苦于以下问题:C++ printd函数的具体用法?C++ printd怎么用?C++ printd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了printd函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: printd
const std::string& ArgumentVector::Argument::get(std::string& dst) const {
if (type != Argument::STRING)
printd(WARNING, "Argument::get(): WARNING: conversion from non-string to string type!\n");
dst = *((std::string*)value);
return dst;
} // get
开发者ID:flair2005,项目名称:inVRs,代码行数:6,代码来源:ArgumentVector.cpp
示例2: qore_cleanup
// NOTE: we do not cleanup in reverse initialization order
// the threading subsystem is deleted before the modules are
// unloaded in case there are any module-specific thread
// cleanup functions to be run...
void qore_cleanup() {
// first delete all user modules
QMM.delUser();
#ifdef _Q_WINDOWS
// do windows socket cleanup
WSACleanup();
#endif
#ifdef HAVE_SIGNAL_HANDLING
// stop signal manager
QSM.del();
#endif
// purge thread resources before deleting modules
{
ExceptionSink xsink;
purge_thread_resources(&xsink);
}
// delete all loadable modules
QMM.cleanup();
// delete thread-local data
delete_thread_local_data();
// now free memory (like ARGV, QORE_ARGV, ENV, etc)
delete_global_variables();
// delete pseudo-methods
pseudo_classes_del();
// delete static system namespace after modules
delete staticSystemNamespace;
#ifdef DEBUG
staticSystemNamespace = 0;
#endif
// delete default type values
delete_qore_types();
// delete threading infrastructure
delete_qore_threads();
// only perform openssl cleanup if not performed externally
if (!qore_check_option(QLO_DISABLE_OPENSSL_CLEANUP)) {
// cleanup openssl library
ERR_free_strings();
ENGINE_cleanup();
EVP_cleanup();
CONF_modules_finish();
CONF_modules_free();
CONF_modules_unload(1);
CRYPTO_cleanup_all_ex_data();
CRYPTO_set_id_callback(0);
CRYPTO_set_locking_callback(0);
// delete openssl locks
for (mutex_vec_t::iterator i = q_openssl_mutex_list.begin(), e = q_openssl_mutex_list.end(); i != e; ++i)
delete *i;
}
printd(5, "qore_cleanup() exiting cleanly\n");
}
开发者ID:qorelanguage,项目名称:qore,代码行数:71,代码来源:qore-main.cpp
示例3: assert
int qore_number_private::formatNumberString(QoreString& num, const QoreString& fmt, ExceptionSink* xsink) {
assert(!num.empty());
assert(num.getEncoding() == fmt.getEncoding());
// get the length of the format string in characters (not bytes)
qore_size_t fl = fmt.length();
if (fmt.empty() || fl == 2) {
printd(5, "qore_number_private::formatNumberString() invalid format string: '%s' for number: '%s'\n", fmt.getBuffer(), num.getBuffer());
return 0;
}
// get thousands separator character
QoreString tsep;
if (tsep.concat(fmt, 0, 1, xsink))
return -1;
// decimal separator
QoreString dsep;
// number of digits after the decimal separator
unsigned prec = 0;
if (fl > 1) {
if (dsep.concat(fmt, 1, 1, xsink))
return -1;
// get byte offset of start of decimal precision number
qore_offset_t i = fmt.getByteOffset(2, xsink);
if (*xsink)
return -1;
assert(i >= 2);
prec = atoi(fmt.getBuffer() + i);
if (!prec)
dsep.clear();
}
//printd(5, "qore_number_private::formatNumberString() tsep: '%s' dsep: '%s' prec: %d '%s'\n", tsep.getBuffer(), dsep.getBuffer(), prec, num.getBuffer());
// find decimal point
qore_offset_t dp = num.find('.');
if (dp != -1) {
// how many digits do we have now after the decimal point
qore_size_t d = num.strlen() - dp - 1;
assert(d);
if (d < prec)
num.addch('0', prec - d);
else if (d > prec) {
if ((num[dp + prec + 1] > '4') && (roundUp(num, dp + prec)))
++dp;
num.terminate(dp + prec + 1);
}
// now substitute decimal point if necessary
if (dsep.strlen() != 1 || dsep[0] != '.')
num.replace(dp, 1, dsep.getBuffer());
}
else {
dp = num.size();
if (prec) {
// add decimal point
num.concat(&dsep, xsink);
assert(!*xsink);
// add zeros for significant digits
num.addch('0', prec);
}
}
// now insert thousands separator
// start of digits before the decimal point
qore_offset_t ds = num[0] == '-' ? 1 : 0;
// work backwards from the decimal point
qore_offset_t i = dp - 3;
while (i > ds) {
num.replace(i, 0, tsep.getBuffer());
i -= 3;
}
//printd(0, "qore_number_private::formatNumberString() ok '%s'\n", num.getBuffer());
//assert(false); xxx
return 0;
}
开发者ID:temnoregg,项目名称:qore,代码行数:78,代码来源:QoreNumberNode.cpp
示例4: rcvr
void *rcvr_thread(void* arg)
{
rcvr(fd, msglen, interval, nmsg);
printd(lostmsgs ? "lost messages" : "");
return 0;
}
开发者ID:rajuvindane,项目名称:akaros,代码行数:6,代码来源:ping.c
示例5: main
int main()
{
printd(-123);
return 0;
}
开发者ID:lignahc,项目名称:Dev,代码行数:6,代码来源:printd.c
示例6: process_line
void process_line(struct ast_node_line* line)
{
struct instruction_mapping* insttype;
struct process_parameters_results ppresults;
struct process_parameter_results dparam;
struct ast_node_parameter* dcurrent;
uint32_t dchrproc;
uint16_t i, flimit, fchar, opos;
struct aout_byte* result = NULL;
struct dbg_sym* newsym;
// Change depending on the type of line.
switch (line->type)
{
case type_keyword:
switch (line->keyword)
{
case SYMBOL:
printd(LEVEL_VERBOSE, ".SYMBOL %s", bstr2cstr(line->keyword_data_string, '0'));
// Emit debugging symbol.
list_append(&newsyms, dbgfmt_create_symbol(DBGFMT_SYMBOL_STRING, dbgfmt_create_symbol_string(line->keyword_data_string, DBGFMT_UNDETERMINED)));
break;
case SECTION:
printd(LEVEL_VERBOSE, ".SECTION %s", bstr2cstr(line->keyword_data_string, '0'));
// Emit section metadata.
aout_emit(aout_create_metadata_section(bstr2cstr(line->keyword_data_string, '0')));
break;
case OUTPUT:
printd(LEVEL_VERBOSE, ".OUTPUT %s", bstr2cstr(line->keyword_data_string, '0'));
// Emit output metadata.
aout_emit(aout_create_metadata_output(bstr2cstr(line->keyword_data_string, '0')));
break;
case BOUNDARY:
printd(LEVEL_VERBOSE, ".BOUNDARY");
// Emit safety boundary of 16 NULL words.
for (i = 0; i < 16; i += 1)
aout_emit(aout_create_raw(0));
break;
case FILL:
printd(LEVEL_VERBOSE, ".FILL");
if (line->keyword_data_expr_1 == NULL || line->keyword_data_expr_2 == NULL)
{
if (line->keyword_data_string != NULL)
dhalt(ERR_LABEL_RESOLUTION_NOT_PERMITTED, line->keyword_data_string->data);
else
dhalt(ERR_LABEL_RESOLUTION_NOT_PERMITTED, "");
}
// Emit N words with value X
flimit = expr_evaluate(line->keyword_data_expr_1, &dhalt_label_resolution_not_permitted, &dhalt_expression_exit_handler);
fchar = expr_evaluate(line->keyword_data_expr_2, &dhalt_label_resolution_not_permitted, &dhalt_expression_exit_handler);
for (i = 0; i < flimit; i++)
aout_emit(aout_create_raw(fchar));
break;
case EXTENSION:
printd(LEVEL_VERBOSE, ".EXTENSION %s", bstr2cstr(line->keyword_data_string, '0'));
// Emit extension metadata.
aout_emit(aout_create_metadata_extension(bstr2cstr(line->keyword_data_string, '0')));
break;
case INCBIN:
printd(LEVEL_VERBOSE, ".INCBIN %s", bstr2cstr(line->keyword_data_string, '0'));
// Emit binary include metadata.
aout_emit(aout_create_metadata_incbin(bstr2cstr(line->keyword_data_string, '0')));
break;
case ORIGIN:
if (line->keyword_data_expr_1 == NULL)
{
if (line->keyword_data_string != NULL)
dhalt(ERR_LABEL_RESOLUTION_NOT_PERMITTED, line->keyword_data_string->data);
else
dhalt(ERR_LABEL_RESOLUTION_NOT_PERMITTED, "");
}
opos = expr_evaluate(line->keyword_data_expr_1, &dhalt_label_resolution_not_permitted, &dhalt_expression_exit_handler);
printd(LEVEL_VERBOSE, ".ORIGIN 0x%04X", opos);
// Emit origin set metadata.
aout_emit(aout_create_metadata_origin(opos));
//.........这里部分代码省略.........
开发者ID:jathd,项目名称:DCPUToolchain,代码行数:101,代码来源:assem.c
示例7: updateDocument
bool Navigation::ConverterToV1_0a4::convert(XmlDocument* document, const Version& version,
std::string configFile) {
bool success = true;
updateDocument(document, XmlConfigurationLoader::XmlDtdUrl + "navigation_v1.0a4.dtd",
destinationVersion, "navigation");
// remove unnecessary <models> element
XmlElement* rootElement = document->getRootElement();
XmlElement* models = document->getElement("navigation.models");
if (!models) {
printd(ERROR,
"Navigation::ConverterToV1_0a4::convert(): missing element <models>! Please fix your Navigation module configuration!\n");
return false;
} // if
// detach models element from root
rootElement->removeSubElement(models);
std::vector<XmlElement*> subElements = models->getAllSubElements();
std::vector<XmlElement*>::iterator it;
XmlElement* subElement;
// move all subelements of models to root
for (it = subElements.begin(); it != subElements.end(); ++it) {
subElement = *it;
models->removeSubElement(subElement);
rootElement->addSubElement(subElement);
// update argument vector (if available)
if (subElement->hasSubElement("arguments")) {
XmlElement* argumentElement = subElement->getSubElement("arguments");
XmlArgumentVectorLoader::get().updateXmlElement(argumentElement, version,
destinationVersion, configFile);
} // if
} // for
delete models;
// rename element names
document->renameElements("navigation.translationmodel", "translationModel");
document->renameElements("navigation.orientationmodel", "orientationModel");
document->renameElements("navigation.speedmodel", "speedModel");
// rename attribute names
document->renameAttributes("navigation.translationModel.name", "type");
document->renameAttributes("navigation.orientationModel.name", "type");
document->renameAttributes("navigation.speedModel.name", "type");
// update deprecated model names
document->replaceAttributeValues("navigation.orientationModel.type",
"OrientationRelativeSensorFlyModel", "OrientationSensorFlyModel");
document->replaceAttributeValues("navigation.orientationModel.type",
"OrientationAbsoluteButtonModel", "OrientationButtonModel");
document->replaceAttributeValues("navigation.orientationModel.type",
"OrientationAbsoluteAxisModel", "OrientationSingleAxisModel");
document->replaceAttributeValues("navigation.orientationModel.type",
"OrientationAbsoluteSingleAxisModel", "OrientationSingleAxisModel");
document->replaceAttributeValues("navigation.orientationModel.type",
"OrientationAbsoluteDualAxisModel", "OrientationDualAxisModel");
document->replaceAttributeValues("navigation.orientationModel.type",
"OrientationAbsoluteSensorModel", "OrientationSensorModel");
document->replaceAttributeValues("navigation.speedModel.type",
"SpeedAbsoluteAxisModel", "SpeedAxisModel");
document->replaceAttributeValues("navigation.speedModel.type",
"SpeedAbsoluteButtonModel", "SpeedButtonModel");
document->replaceAttributeValues("navigation.speedModel.type",
"SpeedAbsoluteMultiButtonModel", "SpeedMultiButtonModel");
document->replaceAttributeValues("navigation.speedModel.type",
"SpeedAbsolute2AxisModel", "SpeedDualAxisModel");
// rename Idx entries to Index
document->replaceAttributeValues("navigation.speedModel.arguments.arg.key",
"axisIdx", "axisIndex");
document->replaceAttributeValues("navigation.speedModel.arguments.arg.key",
"accelButtonIdx", "accelButtonIndex");
document->replaceAttributeValues("navigation.speedModel.arguments.arg.key",
"decelButtonIdx", "decelButtonIndex");
document->replaceAttributeValues("navigation.speedModel.arguments.arg.key",
"axis1Idx", "axis1Index");
document->replaceAttributeValues("navigation.speedModel.arguments.arg.key",
"axis2Idx", "axis2Index");
document->replaceAttributeValues("navigation.translationModel.arguments.arg.key",
"sensorIdx", "sensorIndex");
document->replaceAttributeValues("navigation.translationModel.arguments.arg.key",
"frontIdx", "frontIndex");
document->replaceAttributeValues("navigation.translationModel.arguments.arg.key",
"backIdx", "backIndex");
document->replaceAttributeValues("navigation.translationModel.arguments.arg.key",
"leftIdx", "leftIndex");
document->replaceAttributeValues("navigation.translationModel.arguments.arg.key",
"rightIdx", "rightIndex");
document->replaceAttributeValues("navigation.translationModel.arguments.arg.key",
"leftRightIdx", "leftRightIndex");
document->replaceAttributeValues("navigation.translationModel.arguments.arg.key",
"frontBackIdx", "frontBackIndex");
document->replaceAttributeValues("navigation.orientationModel.arguments.arg.key",
"sensorIdx", "sensorIndex");
document->replaceAttributeValues("navigation.orientationModel.arguments.arg.key",
"buttonIdx", "buttonIndex");
document->replaceAttributeValues("navigation.orientationModel.arguments.arg.key",
"leftIdx", "leftIndex");
document->replaceAttributeValues("navigation.orientationModel.arguments.arg.key",
//.........这里部分代码省略.........
开发者ID:flair2005,项目名称:inVRs,代码行数:101,代码来源:Navigation.cpp
示例8: epos_Modes_of_Operation_Display
int epos_Modes_of_Operation_Display(uint16_t node_id, enum Epos_mode mode) {
int result;
SDO_data d;
d.nodeid = node_id;
d.index = 0x6061;
d.subindex = 0x00;
d.data.size = 1;
d.data.data = mode;
result = SDO_write(motor_cfg_fd, &d);
switch (d.data.data) {
case 7:
printd(LOG_ERROR, "Interpolated_Position_Mode\n");
break;
case 6:
printd(LOG_ERROR, "Homing_Mode\n");
break;
case 3:
printd(LOG_ERROR, "Profile_Velocity_Mode\n");
break;
case 1:
printd(LOG_ERROR, "Profile_Position_Mode\n");
break;
case -1:
printd(LOG_ERROR, "Position_Mode\n");
break;
case -2:
printd(LOG_ERROR, "Velocity_Mode\n");
break;
case -3:
printd(LOG_ERROR, "Current_Mode\n");
break;
case -4:
printd(LOG_ERROR, "Diagnostic_Mode\n");
break;
case -5:
printd(LOG_ERROR, "Master_Encoder_Mode\n");
break;
case -6:
printd(LOG_ERROR, "Step_Direction_Mode\n");
break;
default:
printd(LOG_ERROR, "Unknown Mode\n");
return 1;
}
return 0;
}
开发者ID:reneulab,项目名称:epos-master,代码行数:46,代码来源:epos.c
示例9: main
//---------------------------------------------------------------------------------
int main(int argc, char **argv)
{
IOS_ReloadIOS(56);
InitVideo ();
printd ("---------------------------------------------------------------------------");
printd (" neekbooter "VER" by stfour");
printd (" (part of postLoader project)");
printd ("---------------------------------------------------------------------------");
u32 idx = -1;
u32 status = 0;
u32 hi, lo;
u32 back2real;
if (neek_PLNandInfo (0, &idx, &status, &lo, &hi, &back2real) == false)
{
printd ("no boot information...");
Reload ();
}
printd ("idx = %d", idx);
printd ("status = %d", status);
if (status == PLNANDSTATUS_NONE)
{
status = PLNANDSTATUS_BOOTING;
neek_PLNandInfo (1, &idx, &status, &lo, &hi, &back2real);
if (!hi && !lo)
{
printd ("booting disk");
// Copy the di image
memcpy(EXECUTE_ADDR, di_dol, di_dol_size);
DCFlushRange((void *) EXECUTE_ADDR, di_dol_size);
// Load the booter
memcpy(BOOTER_ADDR, booter_dol, booter_dol_size);
DCFlushRange(BOOTER_ADDR, booter_dol_size);
memset(ARGS_ADDR, 0, sizeof(struct __argv));
DCFlushRange(ARGS_ADDR, sizeof(struct __argv));
printd ("stating di");
entrypoint hbboot_ep = (entrypoint) BOOTER_ADDR;
// bootit !
u32 level;
SYS_ResetSystem(SYS_SHUTDOWN, 0, 0);
_CPU_ISR_Disable(level);
__exception_closeall();
hbboot_ep();
_CPU_ISR_Restore(level);
}
else
{
printd ("booting channel");
WII_Initialize();
WII_LaunchTitle((u64)(TITLE_ID (hi, lo)));
exit(0); // Use exit() to exit a program, do not use 'return' from main()
/*
s_nandbooter nb ATTRIBUTE_ALIGN(32);
u8 *tfb = ((u8 *) 0x93200000);
memset (&nb, 0, sizeof (s_nandbooter));
nb.channel.language = -1;
nb.channel.titleId = TITLE_ID (hi, lo);
nb.channel.bootMode = 1;
// Copy the triiforce image
memcpy(EXECUTE_ADDR, nandbooter_dol, nandbooter_dol_size);
DCFlushRange((void *) EXECUTE_ADDR, nandbooter_dol_size);
// Load the booter
memcpy(BOOTER_ADDR, booter_dol, booter_dol_size);
DCFlushRange(BOOTER_ADDR, booter_dol_size);
memset(ARGS_ADDR, 0, sizeof(struct __argv));
DCFlushRange(ARGS_ADDR, sizeof(struct __argv));
memcpy (tfb, &nb, sizeof(s_nandbooter));
printd ("stating nandbooter");
entrypoint hbboot_ep = (entrypoint) BOOTER_ADDR;
u32 level;
SYS_ResetSystem(SYS_SHUTDOWN, 0, 0);
_CPU_ISR_Disable(level);
__exception_closeall();
//.........这里部分代码省略.........
开发者ID:variantLegend,项目名称:postloader,代码行数:101,代码来源:main.c
示例10: main
//.........这里部分代码省略.........
std::string skyPath = Configuration::getPath("Skybox");
skybox.init(5,5,5, 1000, (skyPath+"lostatseaday/lostatseaday_dn.jpg").c_str(),
(skyPath+"lostatseaday/lostatseaday_up.jpg").c_str(),
(skyPath+"lostatseaday/lostatseaday_ft.jpg").c_str(),
(skyPath+"lostatseaday/lostatseaday_bk.jpg").c_str(),
(skyPath+"lostatseaday/lostatseaday_rt.jpg").c_str(),
(skyPath+"lostatseaday/lostatseaday_lf.jpg").c_str());
//----------------------------------------------------------------------------//
// Snippet-2-15 - END //
//----------------------------------------------------------------------------//
NodePtr root = Node::create();
beginEditCP(root);
root->setCore(Group::create());
//----------------------------------------------------------------------------//
// Snippet-1-3 - BEGIN //
//----------------------------------------------------------------------------//
OpenSGSceneGraphInterface* sgIF =
dynamic_cast<OpenSGSceneGraphInterface*>(OutputInterface::getSceneGraphInterface());
if (!sgIF) {
printf("Error: Failed to get OpenSGSceneGraphInterface!\n");
printf("Please check if the OutputInterface configuration is correct!\n");
return -1;
}
// retrieve root node of the SceneGraphInterface (method is OpenSG specific)
NodePtr scene = sgIF->getNodePtr();
root->addChild(scene);
//----------------------------------------------------------------------------//
// Snippet-1-3 - END //
//----------------------------------------------------------------------------//
//----------------------------------------------------------------------------//
// Snippet-2-16 - BEGIN //
//----------------------------------------------------------------------------//
// add the SkyBox to the scene
root->addChild(skybox.getNodePtr());
//----------------------------------------------------------------------------//
// Snippet-2-16 - END //
//----------------------------------------------------------------------------//
endEditCP(root);
//----------------------------------------------------------------------------//
// Snippet-2-5 - BEGIN //
//----------------------------------------------------------------------------//
// fetch users camera, it is used to tell the Navigator where we are
localUser = UserDatabase::getLocalUser();
if (!localUser) {
printd(ERROR, "Error: Could not find localUser!\n");
return -1;
}
camera = localUser->getCamera();
if (!camera) {
printd(ERROR, "Error: Could not find camera!\n");
return -1;
}
avatar = localUser->getAvatar();
if (!avatar) {
printd(ERROR, "Error: Could not find avatar!\n");
return -1;
}
avatar->showAvatar(false);
// set our transformation to the start transformation
TransformationData startTrans =
WorldDatabase::getEnvironmentWithId(1)->getStartTransformation(0);
localUser->setNavigatedTransformation(startTrans);
//----------------------------------------------------------------------------//
// Snippet-2-5 - END //
//----------------------------------------------------------------------------//
mgr = new SimpleSceneManager; // create the SimpleSceneManager
mgr->setWindow(gwin); // tell the manager what to manage
mgr->setRoot(root); // attach the scenegraph to the root node
mgr->showAll(); // show the whole scene
mgr->getCamera()->setNear(0.1);
//----------------------------------------------------------------------------//
// Snippet-2-6 - BEGIN //
//----------------------------------------------------------------------------//
// Navigator is part of SimpleSceneManager and not of the inVRs framework
Navigator *nav = mgr->getNavigator();
nav->setMode(Navigator::NONE); // turn off the navigator
lastTimeStamp = timer.getTime(); // initialize timestamp;
camMatrix = gmtl::MAT_IDENTITY44F; // initial setting of the camera matrix
//----------------------------------------------------------------------------//
// Snippet-2-6 - END //
//----------------------------------------------------------------------------//
//----------------------------------------------------------------------------//
// Snippet-5-2 //
//----------------------------------------------------------------------------//
glutMainLoop(); // GLUT main loop
return 0;
}
开发者ID:flair2005,项目名称:inVRs,代码行数:101,代码来源:MedievalTown.cpp
示例11: cbuf_collect
//.........这里部分代码省略.........
if (unlikely(!cci)) goto done;
}
if (cbuf_free_unmap(cci, cbi)) goto done;
if (cci->allocated_size < cci->target_size) {
cbuf_thd_wake_up(cci, cci->target_size - cci->allocated_size);
}
ret = 0;
done:
tracking_end(NULL, CBUF_DEL);
CBUF_RELEASE();
return ret;
}
/*
* Called by cbuf2buf to retrieve a given cbid.
*/
int
cbuf_retrieve(spdid_t spdid, unsigned int cbid, unsigned long size)
{
struct cbuf_comp_info *cci, *own;
struct cbuf_info *cbi;
struct cbuf_meta *meta, *own_meta;
struct cbuf_maps *map;
vaddr_t dest;
void *page;
int ret = -EINVAL, off;
printl("cbuf_retrieve\n");
CBUF_TAKE();
tracking_start(NULL, CBUF_RETRV);
cci = cbuf_comp_info_get(spdid);
if (!cci) {printd("no cci\n"); goto done; }
cbi = cmap_lookup(&cbufs, cbid);
if (!cbi) {printd("no cbi\n"); goto done; }
/* shouldn't cbuf2buf your own buffer! */
if (cbi->owner.spdid == spdid) {
printd("owner\n");
goto done;
}
meta = cbuf_meta_lookup(cci, cbid);
if (!meta) {printd("no meta\n"); goto done; }
assert(!(meta->nfo & ~CBUF_INCONSISENT));
map = malloc(sizeof(struct cbuf_maps));
if (!map) {printd("no map\n"); ERR_THROW(-ENOMEM, done); }
if (size > cbi->size) {printd("too big\n"); goto done; }
assert(round_to_page(cbi->size) == cbi->size);
size = cbi->size;
/* TODO: change to MAPPING_READ */
if (cbuf_alloc_map(spdid, &map->addr, NULL, cbi->mem, size, MAPPING_RW)) {
printc("cbuf mgr map fail spd %d mem %p sz %lu cbid %u\n", spdid, cbi->mem, size, cbid);
goto free;
}
INIT_LIST(map, next, prev);
ADD_LIST(&cbi->owner, map, next, prev);
CBUF_PTR_SET(meta, map->addr);
map->spdid = spdid;
map->m = meta;
meta->sz = cbi->size >> PAGE_ORDER;
meta->cbid_tag.cbid = cbid;
own = cbuf_comp_info_get(cbi->owner.spdid);
if (unlikely(!own)) goto done;
/*
开发者ID:georgit,项目名称:Composite,代码行数:67,代码来源:cbuf_mgr.c
示例12: kerberos4_is
void
kerberos4_is(Authenticator *ap, unsigned char *data, int cnt)
{
struct sockaddr_in addr;
char realm[REALM_SZ];
char instance[INST_SZ];
int r;
int addr_len;
if (cnt-- < 1)
return;
switch (*data++) {
case KRB_AUTH:
if (krb_get_lrealm(realm, 1) != KSUCCESS) {
Data(ap, KRB_REJECT, (void *)"No local V4 Realm.", -1);
auth_finished(ap, AUTH_REJECT);
if (auth_debug_mode)
printf("No local realm\r\n");
return;
}
memmove(auth.dat, data, auth.length = cnt);
if (auth_debug_mode) {
printf("Got %d bytes of authentication data\r\n", cnt);
printf("CK: %d:", kerberos4_cksum(auth.dat, auth.length));
printd(auth.dat, auth.length);
printf("\r\n");
}
k_getsockinst(0, instance, sizeof(instance));
addr_len = sizeof(addr);
if(getpeername(0, (struct sockaddr *)&addr, &addr_len) < 0) {
if(auth_debug_mode)
printf("getpeername failed\r\n");
Data(ap, KRB_REJECT, "getpeername failed", -1);
auth_finished(ap, AUTH_REJECT);
return;
}
r = krb_rd_req(&auth, KRB_SERVICE_NAME,
instance, addr.sin_addr.s_addr, &adat, "");
if (r) {
if (auth_debug_mode)
printf("Kerberos failed him as %s\r\n", name);
Data(ap, KRB_REJECT, (void *)krb_get_err_text(r), -1);
auth_finished(ap, AUTH_REJECT);
return;
}
/* save the session key */
memmove(session_key, adat.session, sizeof(adat.session));
krb_kntoln(&adat, name);
if (UserNameRequested && !kuserok(&adat, UserNameRequested)){
char ts[MAXPATHLEN];
struct passwd *pw = getpwnam(UserNameRequested);
if(pw){
snprintf(ts, sizeof(ts),
"%s%u",
TKT_ROOT,
(unsigned)pw->pw_uid);
setenv("KRBTKFILE", ts, 1);
}
Data(ap, KRB_ACCEPT, NULL, 0);
} else {
char *msg;
asprintf (&msg, "user `%s' is not authorized to "
"login as `%s'",
krb_unparse_name_long(adat.pname,
adat.pinst,
adat.prealm),
UserNameRequested ? UserNameRequested : "<nobody>");
if (msg == NULL)
Data(ap, KRB_REJECT, NULL, 0);
else {
Data(ap, KRB_REJECT, (void *)msg, -1);
free(msg);
}
}
auth_finished(ap, AUTH_USER);
break;
case KRB_CHALLENGE:
#ifndef ENCRYPTION
Data(ap, KRB_RESPONSE, NULL, 0);
#else
if(!VALIDKEY(session_key)){
Data(ap, KRB_RESPONSE, NULL, 0);
break;
}
des_key_sched(&session_key, sched);
{
des_cblock d_block;
int i;
Session_Key skey;
memmove(d_block, data, sizeof(d_block));
/* make a session key for encryption */
des_ecb_encrypt(&d_block, &session_key, sched, 1);
skey.type=SK_DES;
skey.length=8;
//.........这里部分代码省略.........
开发者ID:aunali1,项目名称:exopc,代码行数:101,代码来源:kerberos.c
示例13: kerberos4_send
static int
kerberos4_send(char *name, Authenticator *ap)
{
KTEXT_ST auth;
char instance[INST_SZ];
char *realm;
CREDENTIALS cred;
int r;
printf("[ Trying %s ... ]\r\n", name);
if (!UserNameRequested) {
if (auth_debug_mode) {
printf("Kerberos V4: no user name supplied\r\n");
}
return(0);
}
memset(instance, 0, sizeof(instance));
if ((realm = krb_get_phost(RemoteHostName)))
strncpy(instance, realm, sizeof(instance));
instance[sizeof(instance)-1] = '\0';
realm = dest_realm ? dest_realm : krb_realmofhost(RemoteHostName);
if (!realm) {
printf("Kerberos V4: no realm for %s\r\n", RemoteHostName);
return(0);
}
r = krb_mk_req(&auth, KRB_SERVICE_NAME, instance, realm, 0L);
if (r) {
printf("mk_req failed: %s\r\n", krb_get_err_text(r));
return(0);
}
r = krb_get_cred(KRB_SERVICE_NAME, instance, realm, &cred);
if (r) {
printf("get_cred failed: %s\r\n", krb_get_err_text(r));
return(0);
}
if (!auth_sendname(UserNameRequested, strlen(UserNameRequested))) {
if (auth_debug_mode)
printf("Not enough room for user name\r\n");
return(0);
}
if (auth_debug_mode)
printf("Sent %d bytes of authentication data\r\n", auth.length);
if (!Data(ap, KRB_AUTH, (void *)auth.dat, auth.length)) {
if (auth_debug_mode)
printf("Not enough room for authentication data\r\n");
return(0);
}
#ifdef ENCRYPTION
/* create challenge */
if ((ap->way & AUTH_HOW_MASK)==AUTH_HOW_MUTUAL) {
int i;
des_key_sched(&cred.session, sched);
des_init_random_number_generator(&cred.session);
des_new_random_key(&session_key);
des_ecb_encrypt(&session_key, &session_key, sched, 0);
des_ecb_encrypt(&session_key, &challenge, sched, 0);
/*
old code
Some CERT Advisory thinks this is a bad thing...
des_init_random_number_generator(&cred.session);
des_new_random_key(&challenge);
des_ecb_encrypt(&challenge, &session_key, sched, 1);
*/
/*
* Increment the challenge by 1, and encrypt it for
* later comparison.
*/
for (i = 7; i >= 0; --i)
if(++challenge[i] != 0) /* No carry! */
break;
des_ecb_encrypt(&challenge, &challenge, sched, 1);
}
#endif
if (auth_debug_mode) {
printf("CK: %d:", kerberos4_cksum(auth.dat, auth.length));
printd(auth.dat, auth.length);
printf("\r\n");
printf("Sent Kerberos V4 credentials to server\r\n");
}
return(1);
}
开发者ID:aunali1,项目名称:exopc,代码行数:92,代码来源:kerberos.c
示例14: auth_send
/*
* This is called when an AUTH SEND is received.
* It should never arrive on the server side (as only the server can
* send an AUTH SEND).
* You should probably respond to it if you can...
*
* If you want to respond to the types out of order (i.e. even
* if he sends LOGIN KERBEROS and you support both, you respond
* with KERBEROS instead of LOGIN (which is against what the
* protocol says)) you will have to hack this code...
*/
void
auth_send(unsigned char *data, int cnt)
{
Authenticator *ap;
static unsigned char str_none[] = { IAC, SB, TELOPT_AUTHENTICATION,
TELQUAL_IS, AUTHTYPE_NULL, 0,
IAC, SE };
if (Server) {
if (auth_debug_mode) {
printf(">>>%s: auth_send called!\r\n", Name);
}
return;
}
if (auth_debug_mode) {
printf(">>>%s: auth_send got:", Name);
printd(data, cnt); printf("\r\n");
}
/*
* Save the data, if it is new, so that we can continue looking
* at it if the authorization we try doesn't work
*/
if (data < _auth_send_data ||
data > _auth_send_data + sizeof(_auth_send_data)) {
auth_send_cnt = (size_t)cnt > sizeof(_auth_send_data)
? sizeof(_auth_send_data)
: cnt;
memmove((void *)_auth_send_data, (void *)data, auth_send_cnt);
auth_send_data = _auth_send_data;
} else {
/*
* This is probably a no-op, but we just make sure
*/
auth_send_data = data;
auth_send_cnt = cnt;
}
while ((auth_send_cnt -= 2) >= 0) {
if (auth_debug_mode)
printf(">>>%s: He supports %d\r\n",
Name, *auth_send_data);
if ((i_support & ~i_wont_support) & typemask(*auth_send_data)) {
ap = findauthenticator(auth_send_data[0],
auth_send_data[1]);
if (ap && ap->send) {
if (auth_debug_mode)
printf(">>>%s: Trying %d %d\r\n",
Name, auth_send_data[0],
auth_send_data[1]);
if ((*ap->send)(ap)) {
/*
* Okay, we found one we like
* and did it.
* we can go home now.
*/
if (auth_debug_mode)
printf(">>>%s: Using type %d\r\n",
Name, *auth_send_data);
auth_send_data += 2;
return;
}
}
/* else
* just continue on and look for the
* next one if we didn't do anything.
*/
}
auth_send_data += 2;
}
net_write(str_none, sizeof(str_none));
printsub('>', &str_none[2], sizeof(str_none) - 2);
if (auth_debug_mode)
printf(">>>%s: Sent failure message\r\n", Name);
auth_finished(0, AUTH_REJECT);
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:86,代码来源:auth.c
示例15: process_address
struct process_parameter_results process_address(struct ast_node_address* param)
{
struct process_parameter_results result;
struct register_mapping* registr;
bstring btmp = NULL;
result.v_raw = NULL;
if (param->value != NULL)
btmp = expr_representation(param->value);
if (param->bracketed && param->added)
{
// This is of the form [0x1000+I].
registr = get_register_by_name_next(param->addcmpt);
if (registr == NULL)
{
// Attempt to use a label in square brackets. Convert this
// to an expression and then reinvoke ourselves with the
// evaluated value.
param->value = expr_new(expr_new_label(bautofree(bfromcstr(param->addcmpt))), EXPR_OP_ADD, param->value);
param->addcmpt = "";
param->added = 0;
param->bracketed = 0;
bdestroy(btmp);
return process_address(param);
}
else if (registr->value == VALUE_NEXT_UNSUPPORTED)
{
// Attempt to use a register in brackets that can't be.
printd(LEVEL_VERBOSE, "\n");
dhalt(ERR_NEXTED_REGISTER_UNSUPPORTED, param->addcmpt);
}
printd(LEVEL_VERBOSE, "[%s+%s]", btmp->data, registr->name);
result.v = registr->value;
result.v_extra = param->value;
result.v_extra_used = true;
result.v_label = NULL;
}
else
{
// This is either the form 0x1000 or [0x1000].
if (param->bracketed)
{
printd(LEVEL_VERBOSE, "[%s]", btmp->data);
result.v = NXT;
}
else
{
printd(LEVEL_VERBOSE, "%s", btmp->data);
result.v = NXT_LIT;
}
result.v_extra = param->value;
result.v_extra_used = true;
result.v_label = NULL;
}
if (btmp != NULL)
bdestroy(btmp);
return result;
}
开发者ID:jathd,项目名称:DCPUToolchain,代码行数:65,代码来源:assem.c
示例16: printd
void SystemCoreRequestSyncEvent::encode(NetMessage* message) {
printd(INFO, "SystemCoreRequestSyncEvent::encode(): encoding userId %u\n",
requestUserId);
message->putUInt32(requestUserId);
} // encode
开发者ID:flair2005,项目名称:inVRs,代码行数:5,代码来源:SystemCoreEvents.cpp
示例17: process_parameters
struct process_parameters_results process_parameters(struct ast_node_parameters* params)
{
struct process_parameters_results result;
struct process_parameter_results t;
reverse_parameters(params);
result.raw = NULL;
if (params->last != NULL)
{
t = process_parameter(params->last);
if (t.v_raw)
{
printd(LEVEL_VERBOSE, "\n");
dhalt(ERR_GEN_UNSUPPORTED_PARAMETER, NULL);
}
result.a = t.v;
result.a_extra = t.v_extra;
result.a_extra_used = t.v_extra_used;
result.a_label = t.v_label;
result.a_label_bracketed = t.v_label_bracketed;
if (params->last->prev != NULL)
{
t = process_parameter(params->last->prev);
if (t.v_raw)
{
printd(LEVEL_VERBOSE, "\n");
dhalt(ERR_GEN_UNSUPPORTED_PARAMETER, NULL);
}
result.b = t.v;
result.b_extra = t.v_extra;
result.b_extra_used = t.v_extra_used;
result.b_label = t.v_label;
result.b_label_bracketed = t.v_label_bracketed;
}
else
{
result.b = 0x0;
result.b_extra = 0x0;
result.b_extra_used = false;
result.b_label = NULL;
result.b_label_bracketed = false;
}
}
else
{
result.a = 0x0;
result.a_extra = 0x0;
result.a_extra_used = false;
result.a_label = NULL;
result.b_label_bracketed = false;
result.b = 0x0;
result.b_extra = 0x0;
result.b_extra_used = false;
result.b_label = NULL;
result.b_label_bracketed = false;
}
return result;
}
开发者ID:jathd,项目名称:DCPUToolchain,代码行数:64,代码来源:assem.c
示例18: printd
bool Navigation::loadConfig(std::string configFile) {
std::string configFileConcatenatedPath = configFile;
if (!Configuration::containsPath("NavigationModuleConfiguration") &&
Configuration::containsPath("NavigationConfiguration")) {
printd(WARNING,
"Navigation::loadConfig(): Deprecated path entry NavigationConfiguration found in general configuration file! Use NavigationModuleConfiguration instead!\n");
configFileConcatenatedPath = getConcatenatedPath(configFile, "
|
请发表评论