v_listener v_listenerNew( v_participant p, c_bool combine) { v_listener _this; v_kernel kernel; assert(C_TYPECHECK(p,v_participant)); kernel = v_objectKernel(p); _this = v_listener(v_objectNew(kernel,K_LISTENER)); if (_this != NULL) { v_publicInit(v_public(_this)); (void)c_mutexInit(c_getBase(_this), &_this->mutex); c_condInit(c_getBase(_this), &_this->cv, &_this->mutex); _this->participant = p; _this->eventList = NULL; _this->lastEvent = NULL; v_participantAdd(p, v_object(_this)); _this->terminate = FALSE; _this->waitCount = 0; _this->combine = combine; } return _this; }
char * idl_genXMLmeta ( c_type type) { sd_serializer metaSer; sd_serializedData serData; char *metaDescription = NULL; c_iter replaceInfo; c_iter replaceInfoStac; replaceInfo = idl_catsDefConvertAll(idl_catsDefDefGet()); replaceInfoStac = idl_stacDefConvertAll(idl_stacDefDefGet()); metaSer = sd_serializerXMLTypeinfoNew (c_getBase(c_object(type)), TRUE); if (metaSer) { serData = sd_serializerSerialize (metaSer, c_object(type)); if (serData) { metaDescription = sd_serializerToString (metaSer, serData); } sd_serializerFree (metaSer); } idl_catsDefRestoreAll(idl_catsDefDefGet(), replaceInfo); idl_stacDefRestoreAll(idl_stacDefDefGet(), replaceInfoStac); return metaDescription; }
v_cache v_cacheNew ( v_kernel kernel, c_type type, v_cacheKind kind) { c_base base = NULL; c_type cache_t; v_cache cache = NULL; assert(C_TYPECHECK(cache,v_cache)); assert(C_TYPECHECK(type,c_type)); if (type) { base = c_getBase(type); if (base) { cache_t = c_keep(v_kernelType(kernel,K_CACHE)); cache = c_new(cache_t); c_free(cache_t); if (cache) { cache->kind = kind; cache->itemType = c_keep(type); v_cacheNodeInit(v_cacheNode(cache)); } } } return cache; }
void v_subscriberUnSubscribe( v_subscriber s, const c_char *partitionExpr) { v_partition d; v_dataReaderConnectionChanges arg; v_partitionPolicy old; assert(s != NULL); assert(C_TYPECHECK(s,v_subscriber)); arg.addedPartitions = NULL; c_lockWrite(&s->lock); arg.removedPartitions = v_partitionAdminRemove(s->partitions, partitionExpr); old = s->qos->partition; s->qos->partition = v_partitionPolicyRemove(old, partitionExpr, c_getBase(c_object(s))); c_free(old); c_setWalk(s->readers, qosChangedAction, &arg); d = v_partition(c_iterTakeFirst(arg.removedPartitions)); while (d != NULL) { c_free(d); d = v_partition(c_iterTakeFirst(arg.removedPartitions)); } c_iterFree(arg.removedPartitions); c_lockUnlock(&s->lock); }
v_message v_messageEOTExtConvertFromExtType ( v_messageEOTExt xmsg_eot) { c_type msgType = c_resolve(c_getBase((c_object)xmsg_eot), "kernelModuleI::v_messageEOT"); return v_messageExtConvertFromExtType (msgType, (v_messageExt) xmsg_eot); }
v_historicalDataRequest v_historicalDataRequestNew( v_kernel kernel, c_char* filter, c_char* params[], c_ulong nofParams, c_time minSourceTime, c_time maxSourceTime, struct v_resourcePolicy *resourceLimits) { v_historicalDataRequest request; c_ulong i; c_type type; c_base base; request = c_new(v_kernelType(kernel,K_HISTORICALDATAREQUEST)); if (request) { if(filter){ base = c_getBase(kernel); request->filter = c_stringNew(base, filter); if(params){ type = c_string_t(base); request->filterParams = c_arrayNew(type, nofParams); for(i=0; i<nofParams; i++){ request->filterParams[i] = c_stringNew(base, params[i]); } } else { request->filterParams = NULL; } } else { request->filter = NULL; request->filterParams = NULL; } if ((minSourceTime.seconds == C_TIME_INVALID.seconds) && (minSourceTime.nanoseconds == C_TIME_INVALID.nanoseconds)) { request->minSourceTimestamp = C_TIME_ZERO; } else { request->minSourceTimestamp = minSourceTime; } if ((maxSourceTime.seconds == C_TIME_INVALID.seconds) && (maxSourceTime.nanoseconds == C_TIME_INVALID.nanoseconds)) { request->maxSourceTimestamp = C_TIME_INFINITE; } else { request->maxSourceTimestamp = maxSourceTime; } request->resourceLimits.max_samples = resourceLimits->max_samples; request->resourceLimits.max_instances = resourceLimits->max_instances; request->resourceLimits.max_samples_per_instance = resourceLimits->max_samples_per_instance; } else { OS_REPORT(OS_ERROR, "v_historicalDataRequestNew",0, "Failed to allocate request."); assert(FALSE); } return request; }
const c_char* cmx_participantRegisterType( const c_char* participant, const c_char* type) { sd_serializer serializer; sd_serializedData meta_data; cmx_entityKernelArg kernelArg; c_type topicType; cmx_entity ce; const c_char* result; const c_char* msg; ce = cmx_entityClaim(participant); if(ce != NULL){ kernelArg = cmx_entityKernelArg(os_malloc(C_SIZEOF(cmx_entityKernelArg))); if (u_observableAction(u_observable(ce->uentity), cmx_entityKernelAction, (c_voidp)kernelArg) == U_RESULT_OK) { serializer = sd_serializerXMLMetadataNew(c_getBase(c_object(kernelArg->kernel))); if(serializer != NULL){ meta_data = sd_serializerFromString(serializer, type); if (meta_data != NULL) { topicType = c_type(sd_serializerDeserialize(serializer, meta_data)); if (topicType == NULL) { msg = sd_serializerLastValidationMessage(serializer); OS_REPORT(OS_ERROR, CM_XML_CONTEXT, 0, "Data type could not be registered, " "because it is not valid: %s", msg); result = CMX_RESULT_FAILED; } else { result = CMX_RESULT_OK; } sd_serializedDataFree(meta_data); } else { OS_REPORT(OS_ERROR, CM_XML_CONTEXT, 0, "Construction of serialized data failed."); result = CMX_RESULT_FAILED; } sd_serializerFree(serializer); } else { OS_REPORT(OS_ERROR, CM_XML_CONTEXT, 0, "Serializer could not be initialized"); result = CMX_RESULT_FAILED; } } else { OS_REPORT(OS_ERROR, CM_XML_CONTEXT, 0, "Kernel object could not be retrieved"); result = CMX_RESULT_FAILED; } os_free(kernelArg); cmx_entityRelease(ce); } else { result = CMX_RESULT_FAILED; } return result; }
v_persistentSnapshotRequest v_persistentSnapshotRequestNew( v_kernel kernel, const c_char* partition_expression, const c_char* topic_expression, const c_char* uri) { v_persistentSnapshotRequest request; c_base base; request = c_new(v_kernelType(kernel,K_PERSISTENTSNAPSHOTREQUEST)); if(request) { base = c_getBase(kernel); if(partition_expression) { request->partitionExpr = c_stringNew(base, partition_expression); } if(topic_expression) { request->topicExpr = c_stringNew(base, topic_expression); } if(uri) { request->uri = c_stringNew(base, uri); } } else { OS_REPORT(OS_ERROR, "v_kernel::v_persistentSnapshotRequest",0, "Failed to create v_persistentSnapshotRequest object."); assert(FALSE); } return request; }
v_networkQueueStatistics v_networkQueueStatisticsNew(v_kernel k, const c_char *name) { v_networkQueueStatistics nqs; c_string channelName; assert(k != NULL); assert(C_TYPECHECK(k, v_kernel)); if (networkQueueStatisticsType == NULL) { networkQueueStatisticsType = c_resolve(c_getBase(k), "kernelModule::v_networkQueueStatistics"); } nqs = v_networkQueueStatistics(v_new(k, networkQueueStatisticsType)); channelName = c_stringNew(c_getBase(c_object(k)),name); v_networkQueueStatisticsInit(nqs,channelName); return nqs; }
c_bool d_publisherNewGroupWriterCopy( c_type type, void *data, void *to) { c_bool result; d_newGroup msgFrom = (d_newGroup)data; d_newGroup msgTo = (d_newGroup)to; c_base base = c_getBase(type); result = d_publisherMessageWriterCopy(&msgFrom->parentMsg, &msgTo->parentMsg); if(msgFrom->partition){ msgTo->partition = c_stringNew(base, msgFrom->partition); } else { msgTo->partition = NULL; } if(msgFrom->topic){ msgTo->topic = c_stringNew(base, msgFrom->topic); } else { msgTo->topic = NULL; } msgTo->completeness = msgFrom->completeness; msgTo->durabilityKind = msgFrom->durabilityKind; msgTo->quality = msgFrom->quality; msgTo->alignerCount = msgFrom->alignerCount; return result; }
c_bool d_publisherDeleteDataWriterCopy( c_type type, void *data, void *to) { c_bool result; d_deleteData msgFrom = d_deleteData(data); d_deleteData msgTo = d_deleteData(to); c_base base = c_getBase(type); result = d_publisherMessageWriterCopy(&msgFrom->parentMsg, &msgTo->parentMsg); msgTo->actionTime.seconds = msgFrom->actionTime.seconds; msgTo->actionTime.nanoseconds = msgFrom->actionTime.nanoseconds; if(msgFrom->partitionExpr) { msgTo->partitionExpr = c_stringNew(base, msgFrom->partitionExpr); } else { msgTo->partitionExpr = NULL; } if(msgFrom->topicExpr) { msgTo->topicExpr = c_stringNew(base, msgFrom->topicExpr); } else { msgTo->topicExpr = NULL; } return result; }
v_cache v_groupCacheNew ( v_kernel kernel, v_cacheKind kind) { c_base base; c_type type; v_cache cache; assert(C_TYPECHECK(kernel,v_kernel)); base = c_getBase(kernel); type = c_keep(v_kernelType(kernel,K_GROUPCACHEITEM)); cache = v_cacheNew(kernel,type,kind); c_free(type); if (!cache) { OS_REPORT(OS_ERROR, "v_groupCacheNew",0, "Failed to allocate group cache."); } assert(C_TYPECHECK(cache, v_cache)); return cache; }
c_bool d_publisherGroupsRequestWriterCopy( c_type type, void *data, void *to) { c_bool result; d_groupsRequest msgFrom = (d_groupsRequest)data; d_groupsRequest msgTo = (d_groupsRequest)to; c_base base = c_getBase(type); result = d_publisherMessageWriterCopy(&d_groupsRequest(data)->parentMsg, &d_groupsRequest(to)->parentMsg); if(msgFrom->partition){ msgTo->partition = c_stringNew(base, msgFrom->partition); } else { msgTo->partition = NULL; } if(msgFrom->topic){ msgTo->topic = c_stringNew(base, msgFrom->topic); } else { msgTo->topic = NULL; } return result; }
v_result v_participantCandMCommandSetDisposeAllData(v_participant participant, v_message msg, char *topicExpr, char *partitionExpr) { v_kernel kernel; v_topic topic; c_base base; v_controlAndMonitoringCommand *command; struct v_commandDisposeAllData *disposeCmd; assert(participant != NULL); assert(C_TYPECHECK(participant,v_participant)); assert(msg != NULL ); assert(C_TYPECHECK(msg,v_message)); kernel = v_objectKernel(participant); topic = v_builtinTopicLookup(kernel->builtin, V_C_AND_M_COMMAND_ID); command = v_builtinControlAndMonitoringCommandData(kernel->builtin, msg); command->u._d = V_COMMAND_DISPOSE_ALL_DATA; base = c_getBase(c_object(topic)); disposeCmd = &command->u._u.dispose_all_data_info; disposeCmd->topicExpr = c_stringNew(base, topicExpr); disposeCmd->partitionExpr = c_stringNew(base, partitionExpr); return ( ( disposeCmd->topicExpr != NULL && disposeCmd->partitionExpr != NULL ) ? V_RESULT_OK : V_RESULT_OUT_OF_MEMORY ); }
void cmx_writerDataTypeAction( v_entity entity, c_voidp args) { sd_serializer ser; sd_serializedData data; c_type type; struct cmx_writerTypeArg *arg; arg = (struct cmx_writerTypeArg *)args; type = NULL; switch(v_object(entity)->kind){ case K_WRITER: type = v_topicDataType(v_writer(entity)->topic); break; default: OS_REPORT(OS_ERROR, CM_XML_CONTEXT, 0, "Trying to resolve dataType of writer that is not a writer.\n"); assert(FALSE); break; } if(type != NULL){ ser = sd_serializerXMLMetadataNew(c_getBase(type)); data = sd_serializerSerialize(ser, type); arg->result = sd_serializerToString(ser, data); sd_serializedDataFree(data); sd_serializerFree(ser); } }
static c_type createKeyType( const c_char *name, c_array keyList) { c_base base; c_type foundType; c_char *typeName; c_char keyName[16]; c_long i, length, sres; c_array members; c_metaObject o; c_field field; if (keyList == NULL) { return NULL; } base = c_getBase(keyList); length = c_arraySize(keyList); if (length == 0) { return NULL; } o = c_metaDefine(c_metaObject(base),M_STRUCTURE); members = c_arrayNew(c_member_t(base),length); for (i=0;i<length;i++) { field = keyList[i]; assert(field != NULL); members[i] = (c_voidp)c_metaDefine(c_metaObject(base),M_MEMBER); sprintf(keyName,"field%d",i); c_specifier(members[i])->name = c_stringNew(base,keyName); c_specifier(members[i])->type = c_keep(c_fieldType(field)); } c_structure(o)->members = members; c_metaObject(o)->definedIn = c_metaObject(base); c_metaFinalize(o); #define KEY_NAME "<Key>" #define KEY_FORMAT "%s<Key>" if (name != NULL) { length = sizeof(KEY_NAME) + strlen(name); typeName = os_malloc(length); sres = snprintf(typeName,length,KEY_FORMAT,name); assert(sres == (length-1)); } else { assert(FALSE); length = 100; typeName = os_malloc(length); os_sprintf(typeName,PA_ADDRFMT KEY_NAME,(c_address)o); } #undef KEY_NAME #undef KEY_FORMAT foundType = c_type(c_metaBind(c_metaObject(base),typeName,o)); c_free(o); os_free(typeName); return foundType; }
static void retrieveBase(v_entity e, c_voidp arg) { c_base *pbase = (c_base *) arg; *pbase = c_getBase(e); }
void v_participantInit( v_participant p, const c_char *name, v_participantQos qos, v_statistics s, c_bool enable) { v_kernel kernel; c_base base; v_message builtinMsg; c_type writerProxyType; assert(C_TYPECHECK(p,v_participant)); assert(C_TYPECHECK(qos, v_participantQos)); kernel = v_objectKernel(p); base = c_getBase(p); v_observerInit(v_observer(p),name,s,enable); p->entities = c_setNew(c_resolve(base,"kernelModule::v_entity")); p->qos = c_keep(qos); /* Currently default LIVELINESS policy is used: kind=AUTOMATIC, * duration=INFINITE This setting implies no lease registration. */ p->lease = NULL; p->leaseManager = v_leaseManagerNew(kernel); p->resendQuit = FALSE; c_mutexInit(&p->resendMutex, SHARED_MUTEX); c_condInit(&p->resendCond, &p->resendMutex, SHARED_COND); writerProxyType = v_kernelType(kernel,K_PROXY); p->resendWriters = c_tableNew(writerProxyType, "source.index,source.serial"); p->builtinSubscriber = NULL; if (!v_observableAddObserver(v_observable(kernel),v_observer(p), NULL)) { if (name != NULL) { OS_REPORT_1(OS_WARNING,"Kernel Participant",0, "%s: Cannot observe Kernel events",name); } else { OS_REPORT(OS_WARNING,"Kernel Participant",0, "Cannot observe Kernel events"); } } c_mutexInit(&p->newGroupListMutex,SHARED_MUTEX); p->newGroupList = c_listNew(c_resolve(base, "kernelModule::v_group")); v_observerSetEventMask(v_observer(p), V_EVENT_NEW_GROUP); c_lockInit(&p->lock,SHARED_LOCK); c_mutexInit(&p->builtinLock,SHARED_MUTEX); /* Here the Builtin Topic of the participant is published. * This call mabe a noop in case builtin is disabled on kernel level. */ builtinMsg = v_builtinCreateParticipantInfo(kernel->builtin,p); v_writeBuiltinTopic(kernel, V_PARTICIPANTINFO_ID, builtinMsg); c_free(builtinMsg); }
c_char* cmx_writerNew( const c_char* publisher, const c_char* name, const c_char* topic, const c_char* qos) { u_publisher pub; u_topic top; u_writer wri; c_char* result; cmx_entityArg arg; u_result ur; cmx_entityKernelArg kernelArg; v_writerQos wQos; result = NULL; pub = u_publisher(cmx_entityUserEntity(publisher)); if(pub != NULL){ top = u_topic(cmx_entityUserEntity(topic)); if(top != NULL){ kernelArg = cmx_entityKernelArg(os_malloc(C_SIZEOF(cmx_entityKernelArg))); u_entityAction(u_entity(pub), cmx_entityKernelAction, (c_voidp)kernelArg); if(qos != NULL){ wQos = v_writerQos(cmx_qosKernelQosFromKind(qos, K_WRITER, c_getBase(c_object(kernelArg->kernel)))); if(wQos == NULL){ wQos = v_writerQosNew(kernelArg->kernel, NULL); wQos->reliability.kind = V_RELIABILITY_RELIABLE; } } else { wQos = v_writerQosNew(kernelArg->kernel, NULL); wQos->reliability.kind = V_RELIABILITY_RELIABLE; } wri = u_writerNew(pub, name, top, NULL, wQos, TRUE); os_free(kernelArg); c_free(wQos); if(wri != NULL){ cmx_registerEntity(u_entity(wri)); arg = cmx_entityArg(os_malloc(C_SIZEOF(cmx_entityArg))); arg->entity = u_entity(wri); arg->create = FALSE; arg->participant = NULL; arg->result = NULL; ur = u_entityAction(u_entity(wri), cmx_entityNewFromAction, (c_voidp)(arg)); if(ur == U_RESULT_OK){ result = arg->result; os_free(arg); } } } } return result; }
v_subscriber v_participantGetBuiltinSubscriber( v_participant p) { v_subscriberQos sQos; v_readerQos rQos; v_kernel kernel; c_bool create_builtin_readers = FALSE; assert(p != NULL); assert(C_TYPECHECK(p, v_participant)); c_mutexLock(&p->builtinLock); if (p->builtinSubscriber == NULL) { kernel = v_objectKernel(p); sQos = v_subscriberQosNew(kernel, NULL); sQos->presentation.access_scope = V_PRESENTATION_TOPIC; c_free(sQos->partition); sQos->partition = c_stringNew(c_getBase(c_object(kernel)), V_BUILTIN_PARTITION); sQos->entityFactory.autoenable_created_entities = TRUE; p->builtinSubscriber = v_subscriberNew(p, V_BUILTINSUBSCRIBER_NAME, sQos, TRUE); v_subscriberQosFree(sQos); create_builtin_readers = TRUE; c_mutexUnlock(&p->builtinLock); assert(p->builtinSubscriber != NULL); rQos = v_readerQosNew(kernel, NULL); rQos->durability.kind = V_DURABILITY_TRANSIENT; rQos->reliability.kind = V_RELIABILITY_RELIABLE; rQos->history.kind = V_HISTORY_KEEPLAST; rQos->history.depth = 1; #define _CREATE_READER_(topicName) {\ q_expr expr; \ v_dataReader dr; \ expr = q_parse("select * from " topicName);\ dr = v_dataReaderNew(p->builtinSubscriber, topicName "Reader", \ expr, NULL, rQos, TRUE);\ c_free(dr); \ q_dispose(expr); \ } _CREATE_READER_(V_PARTICIPANTINFO_NAME) _CREATE_READER_(V_TOPICINFO_NAME) _CREATE_READER_(V_PUBLICATIONINFO_NAME) _CREATE_READER_(V_SUBSCRIPTIONINFO_NAME) #undef _CREATE_READER_ v_readerQosFree(rQos); } else { c_mutexUnlock(&p->builtinLock); } return c_keep(p->builtinSubscriber); }
c_bool d_publisherSampleChainWriterCopy( c_type type, void *data, void *to) { d_sampleChain msgFrom = d_sampleChain(data); d_sampleChain msgTo = d_sampleChain(to); c_base base = c_getBase(type); static c_type type0 = NULL; static c_type type1 = NULL; unsigned int valueSize; d_publisherMessageWriterCopy(&msgFrom->parentMsg, &msgTo->parentMsg); msgTo->partition = c_stringNew(base, msgFrom->partition); msgTo->topic = c_stringNew(base, msgFrom->topic); msgTo->durabilityKind = msgFrom->durabilityKind; msgTo->msgBody._d = msgFrom->msgBody._d; msgTo->addresseesCount = msgFrom->addresseesCount; assert(msgTo->addresseesCount > 0); if (type1 == NULL) { type1 = c_resolve(base, "durabilityModule2::d_networkAddress_s"); } assert(type1 != NULL); msgTo->addressees = c_arrayNew(type1, msgTo->addresseesCount); assert(msgTo->addressees); memcpy(msgTo->addressees, msgFrom->addressees, msgTo->addresseesCount*C_SIZEOF(d_networkAddress)); msgTo->source.systemId = msgFrom->source.systemId; msgTo->source.localId = msgFrom->source.localId; msgTo->source.lifecycleId = msgFrom->source.lifecycleId; switch(msgTo->msgBody._d) { case BEAD: if (type0 == NULL) { type0 = c_resolve(base, "c_octet"); } assert(type0 != NULL); valueSize = msgFrom->msgBody._u.bead.size; msgTo->msgBody._u.bead.size = valueSize; msgTo->msgBody._u.bead.value = c_arrayNew(type0, valueSize); memcpy(msgTo->msgBody._u.bead.value, msgFrom->msgBody._u.bead.value, valueSize); break; case LINK: msgTo->msgBody._u.link.nrSamples = msgFrom->msgBody._u.link.nrSamples; msgTo->msgBody._u.link.completeness = msgFrom->msgBody._u.link.completeness; break; default: OS_REPORT_1(OS_ERROR, "d_publisherSampleChainWriterCopy", 0, "Illegal message body discriminant value (%d) detected.", msgTo->msgBody._d); assert(FALSE); } return TRUE; }
void in_messageDeserializerReadString( in_messageDeserializer _this, c_type type, c_voidp data) { in_result result = IN_RESULT_OK; c_string str = NULL; os_uint32 stringLength = 0; os_uint32 lenAvail; os_uint32 copyLength; os_char* stringStart; assert(_this); assert(in_messageDeserializerIsValid(_this)); assert(type); assert(data); /* remove excess padding, if any or needed. The transformer may be renewed! */ in_messageDeserializerRemoveCDRPaddingFromStream(_this, sizeof(os_uint32)); /* first read the length of the string, i.e. the number of chars. This * info is stored in an unsigned long, which has size '4' */ assert(sizeof(os_uint32) == 4); in_messageDeserializerReadPrim(_this, sizeof(os_uint32), &stringLength); if (stringLength > 0) { str = c_stringMalloc(c_getBase(type), stringLength); if(str == NULL) { result = IN_RESULT_OUT_OF_MEMORY; } else { while(stringLength != 0) { lenAvail = in_messageTransformerGetAvailable(_this); if (lenAvail == 0) { in_messageTransformerRenew(_this); lenAvail = in_messageTransformerGetAvailable(_this); } if(lenAvail >= stringLength) { copyLength = stringLength; } else { copyLength = lenAvail; } stringStart = (os_char *)in_messageTransformerGetHead(_this); memcpy(str, stringStart, copyLength); in_messageTransformerClaim(_this, copyLength); stringLength -= copyLength; } } } *(c_string *)data = str; }
d_storeResult d_storeMMFKernelMarkNameSpaceComplete( d_storeMMFKernel kernel, const d_nameSpace nameSpace, const c_bool isComplete) { d_nameSpaceInfo nsInfo; c_type type; c_char* name; c_value keyValues[1]; d_storeResult result; if(kernel && nameSpace){ name = d_nameSpaceGetName(nameSpace); keyValues[0] = c_stringValue((c_string)name); nsInfo = c_tableFind(kernel->nameSpaces, keyValues); if(nsInfo){ nsInfo->complete = isComplete; result = D_STORE_RESULT_OK; } else { type = c_resolve(c_getBase(kernel), "durabilityModule2::d_nameSpaceInfo"); nsInfo = (d_nameSpaceInfo)c_new(type); c_free(type); if (nsInfo) { nsInfo->name = c_stringNew(c_getBase(kernel), name); nsInfo->complete = isComplete; c_tableInsert(kernel->nameSpaces, nsInfo); c_free(nsInfo); result = D_STORE_RESULT_OK; } else { OS_REPORT(OS_ERROR, "d_storeMMFKernelMarkNameSpaceComplete",0, "Failed to allocate nameSpaceInfo."); result = D_STORE_RESULT_OUT_OF_RESOURCES; } } } else { result = D_STORE_RESULT_ILL_PARAM; } return result; }
v_networkReader v_networkReaderNew( v_subscriber subscriber, const c_char *name, v_readerQos qos, c_bool ignoreReliabilityQoS) { /* Note: currently, no qos-es are supported. Everything is redirected * to the defaultQueue */ v_kernel kernel; v_networkReader reader; v_readerQos q; v_statistics s; c_type queueType; c_long i; assert(C_TYPECHECK(subscriber,v_subscriber)); /* Creation */ kernel = v_objectKernel(subscriber); q = v_readerQosNew(kernel,qos); if (q != NULL) { reader = v_networkReader(v_objectNew(kernel,K_NETWORKREADER)); s = v_statistics(v_networkReaderStatisticsNew(kernel)); /* Initialization of parent */ v_readerInit(v_reader(reader), name, subscriber, q, s, TRUE); c_free(q); /* ref now in v_reader(queue)->qos */ /* This function only ever called once per network instance so no * need to store queueType as static variable. Look up as needed (once) */ queueType = c_resolve(c_getBase(subscriber),"kernelModule::v_networkQueue"); /* Initialization of self */ reader->queues = NULL; reader->queues = c_arrayNew(queueType, NW_MAX_NOF_QUEUES); reader->nofQueues = 0; reader->defaultQueue = NULL; reader->remoteActivity = FALSE; reader->ignoreReliabilityQoS = ignoreReliabilityQoS; reader->queueCache = c_arrayNew(queueType, 2*NW_MAX_QUEUE_CACHE_PRIO); for( i= 0; i < 2*NW_MAX_QUEUE_CACHE_PRIO; i++) { reader->queueCache[i] = NULL; } c_free(queueType); /* Add to subscriber */ v_subscriberAddReader(subscriber,v_reader(reader)); } else { OS_REPORT(OS_ERROR, "v_networkReaderNew", 0, "NetworkReader not created: inconsistent qos"); reader = NULL; } return reader; }
void d_findBaseAction( v_entity entity, c_voidp args) { struct baseFind* data; data = (struct baseFind*)args; data->base = c_getBase(entity); }
static void fillExprList( void* o, void* udata) { c_list list = udata; char* str = o; /* Insert expressions into list */ c_listInsert(list, c_stringNew(c_getBase(list), str)); }
static c_bool walkProperty( c_metaObject object, c_metaWalkActionArg actionArg) { toolActionData actionData = (toolActionData)actionArg; c_object o; c_voidp addr; o = c_iterObject(actionData->stack, 0); if (c_baseObjectKind(object) == M_ATTRIBUTE) { addr = C_DISPLACE(o, (c_address)c_property(object)->offset); if (c_typeIsRef(c_property(object)->type)) { addr = *(c_voidp *)addr; if (c_baseObjectKind(c_property(object)->type) == M_COLLECTION) { if (addr) { if (c_iterContains(actionData->stack, addr)) { printf("Ignore cyclic reference 0x"PA_ADDRFMT"\n", (os_address)addr); } else { OBJECT_PUSH(actionData, addr); iprintf("%s ",_METANAME(object)); printType(c_property(object)->type, actionData); OBJECT_POP(actionData); } } else { iprintf(" %s <0x"PA_ADDRFMT">", _METANAME(object), (os_address)addr); } } else { iprintf(" %s <0x"PA_ADDRFMT">", _METANAME(object), (os_address)addr); if (addr) { /* Section for code to print additional type specific info. */ if (c_property(object)->type == v_topic_t) { printf(" /* topic name is: %s */", v_topicName(addr)); } if (c_property(object)->type == v_partition_t) { printf(" /* Partition: %s */", v_partitionName(addr)); } if (c_property(object)->type == c_type_t(c_getBase(object))) { printf(" /* Type: %s */", _METANAME(c_type(addr))); } } } printf("\n"); } else { OBJECT_PUSH(actionData, addr); iprintf("%s ",_METANAME(object)); printType(c_property(object)->type, actionData); printf("\n"); OBJECT_POP(actionData); } } return TRUE; }
v_messageEOTExt v_messageEOTExtCopyToExtType ( const struct v_messageEOT_s *vmsg) { c_type xmsgType = c_resolve(c_getBase((c_object)vmsg), "kernelModule::v_messageEOTExt"); v_messageEOTExt xmsg; xmsg = c_new (xmsgType); c_free(xmsgType); v_messageEOTExtConvertToExtNoAllocTime (xmsg, vmsg); return xmsg; }
void v_messageExtConvertHeaderToExtNoAllocTime ( v_messageExt xmsg, const struct v_message_s *vmsg) { c_bool y2038Ready = c_baseGetY2038Ready(c_getBase(c_object(vmsg))); v_messageExtConvertHeaderToExtCommon(xmsg, vmsg, y2038Ready); xmsg->allocTime.seconds = 0; xmsg->allocTime.nanoseconds = 0; }
v_networkChannelStatistics v_networkChannelStatisticsNew( v_kernel k, const c_char *name) { v_networkChannelStatistics ncs; c_string channelName; c_type type; assert(k != NULL); assert(C_TYPECHECK(k, v_kernel)); type = c_resolve(c_getBase(k), "kernelModuleI::v_networkChannelStatistics"); assert(type); ncs = v_networkChannelStatistics(v_new(k, type)); c_free(type); channelName = c_stringNew(c_getBase(c_object(k)),name); v_networkChannelStatisticsInit(ncs,channelName); return ncs; }