#include <embedch.h>
Go to the source code of this file.
Definition in file libmc.h.
An agent's current execution state.
MobileC system signals.
Definition at line 229 of file libmc.c.
References fipa_agent_identifier_s::addresses, fipa_agent_identifier_New(), fipa_agent_identifier_set_New(), fipa_agent_identifier_set_s::fipa_agent_identifiers, fipa_url_New(), fipa_url_sequence_New(), fipa_agent_identifier_s::name, fipa_url_sequence_s::num, fipa_agent_identifier_set_s::num, fipa_acl_message_s::receiver, fipa_acl_message_s::receiver_num, fipa_url_s::str, and fipa_url_sequence_s::urls.
Referenced by MC_AclAddReceiver_chdl().
Definition at line 265 of file libmc.c.
References fipa_agent_identifier_s::addresses, fipa_agent_identifier_New(), fipa_agent_identifier_set_New(), fipa_agent_identifier_set_s::fipa_agent_identifiers, fipa_url_New(), fipa_url_sequence_New(), fipa_agent_identifier_s::name, fipa_url_sequence_s::num, fipa_agent_identifier_set_s::num, fipa_acl_message_s::reply_to, fipa_url_s::str, and fipa_url_sequence_s::urls.
Referenced by MC_AclAddReplyTo_chdl().
Destroy a FIPA ACL message.
Definition at line 72 of file libmc.c.
References fipa_acl_message_Destroy().
Referenced by MC_AclDestroy_chdl().
[read]
Allocate a new ACL Message.
Definition at line 78 of file libmc.c.
References fipa_acl_message_New().
Referenced by MC_AclNew_chdl().
Post ACL message to agent.
Definition at line 83 of file libmc.c.
References agent_mailbox_Post(), and agent_s::mailbox.
Referenced by MC_AclPost_chdl(), and MC_AclSend().
Reply to an ACL message.
Definition at line 89 of file libmc.c.
References fipa_Reply().
Referenced by MC_AclReply_chdl().
Retrieve an ACL message.
Definition at line 95 of file libmc.c.
References agent_mailbox_Retrieve(), and agent_s::mailbox.
Referenced by MC_AclRetrieve_chdl().
Send a composed ACL Message.
Definition at line 101 of file libmc.c.
References fipa_agent_identifier_s::addresses, mtp_http_s::content, mtp_http_content_s::content_type, mtp_http_content_s::data, dynstring_Destroy(), FIPA_ACL, fipa_acl_Compose(), fipa_agent_identifier_set_s::fipa_agent_identifiers, fipa_envelope_Compose(), mtp_http_s::host, http_to_hostport(), MC_AclPost(), MC_FindAgentByName(), dynstring_s::message, message_Destroy(), mtp_http_s::message_parts, message_Send(), message_s::message_type, mtp_http_CreateMessage(), mtp_http_Destroy(), mtp_http_New(), fipa_agent_identifier_s::name, fipa_url_sequence_s::num, fipa_agent_identifier_set_s::num, port, fipa_acl_message_s::receiver, fipa_url_s::str, mtp_http_s::target, message_s::target, and fipa_url_sequence_s::urls.
Referenced by MC_AclSend_chdl().
Definition at line 300 of file libmc.c.
References fipa_string_s::content, fipa_acl_message_s::content, fipa_string_Destroy(), and fipa_string_New().
Referenced by MC_AclSetContent_chdl().
Definition at line 198 of file libmc.c.
References fipa_acl_message_s::performative.
Referenced by MC_AclSetPerformative_chdl().
Definition at line 206 of file libmc.c.
References fipa_agent_identifier_s::addresses, fipa_agent_identifier_Destroy(), fipa_agent_identifier_New(), fipa_url_New(), fipa_url_sequence_New(), fipa_agent_identifier_s::name, fipa_url_sequence_s::num, fipa_acl_message_s::sender, fipa_url_s::str, and fipa_url_sequence_s::urls.
Referenced by MC_AclSetSender_chdl().
Wait for and retrieve an ACL message.
Definition at line 191 of file libmc.c.
References agent_mailbox_WaitRetrieve(), and agent_s::mailbox.
Referenced by MC_AclWaitRetrieve_chdl().
Add an agent to the agency 'attr'.
Definition at line 317 of file libmc.c.
References mc_platform_s::agent_queue, mc_platform_s::ams, COND_SIGNAL, agency_s::mc_platform, agent_s::mc_platform, MUTEX_LOCK, and MUTEX_UNLOCK.
Referenced by MC_AddAgent_chdl().
Retrieve a pointer to a previously saved variable.
Definition at line 330 of file libmc.c.
References agent_task_s::agent_variable_list, interpreter_variable_data_s::data, agent_s::datastate, agent_datastate_s::task_progress, and agent_datastate_s::tasks.
Referenced by MC_AgentVariableRetrieve_chdl().
Mark an agent variable for saving.
Definition at line 348 of file libmc.c.
References agent_s::datastate, MC_ERR_MEMORY, agent_task_s::num_saved_variables, agent_task_s::saved_variables, agent_datastate_s::task_progress, and agent_datastate_s::tasks.
Referenced by MC_AgentVariableSave_chdl().
Find and delete an initialized MobileC Barrier.
Definition at line 409 of file libmc.c.
References mc_platform_s::barrier_queue, barrier_queue_Delete(), and agency_s::mc_platform.
Referenced by MC_BarrierDelete_chdl().
Initialize a MobileC Barrier.
Definition at line 395 of file libmc.c.
References barrier_node_Initialize(), mc_platform_s::barrier_queue, barrier_queue_Add(), barrier_queue_Get(), MC_ERR, agency_s::mc_platform, MC_SUCCESS, and node.
Referenced by MC_BarrierInit_chdl().
Calls a function defined in an agent.
Definition at line 415 of file libmc.c.
References agent_s::agent_interp, MUTEX_LOCK, MUTEX_UNLOCK, and agent_s::run_lock.
Calls a function defined in an agent.
Definition at line 436 of file libmc.c.
References agent_s::agent_interp, MUTEX_LOCK, MUTEX_UNLOCK, and agent_s::run_lock.
Calls a function defined in an agent.
Definition at line 455 of file libmc.c.
References agent_s::agent_interp, MUTEX_LOCK, MUTEX_UNLOCK, and agent_s::run_lock.
Definition at line 475 of file libmc.c.
References agent_s::agent_interp, MUTEX_LOCK, MUTEX_UNLOCK, and agent_s::run_lock.
Referenced by MC_CallAgentFunc_chdl().
Use custom ChOptions_t type for internal Ch interpretor.
Definition at line 495 of file libmc.c.
References mc_platform_s::interp_options, and agency_s::mc_platform.
Compose a new agent dynamically without using a prewritten XML file.
Definition at line 513 of file libmc.c.
References agent_datastate_s::agent_code, agent_datastate_s::agent_code_ids, agent_datastate_s::agent_codes, agent_datastate_New(), agent_New(), agent_s::agent_status, agent_task_New(), agent_s::agent_type, agent_s::datastate, agent_s::home, MC_LOCAL_AGENT, MC_WAIT_MESSGSEND, agent_s::name, agent_datastate_s::number_of_tasks, agent_s::orphan, agent_s::owner, agent_datastate_s::persistent, agent_task_s::server_name, agent_datastate_s::tasks, and agent_task_s::var_name.
Referenced by MC_ComposeAgent_chdl().
Wakes up all agents/threads waiting on a condition variable.
Definition at line 583 of file libmc.c.
References syncListNode_s::cond, COND_BROADCAST, syncListNode_s::lock, MC_ERR_NOT_FOUND, agency_s::mc_platform, MUTEX_LOCK, MUTEX_UNLOCK, syncListNode_s::signalled, mc_platform_s::syncList, and syncListFind().
Referenced by MC_CondBroadcast_chdl().
Reset a previously signalled MobileC condition variable.
Definition at line 635 of file libmc.c.
References syncListNode_s::lock, MC_ERR_NOT_FOUND, agency_s::mc_platform, MUTEX_LOCK, MUTEX_UNLOCK, syncListNode_s::signalled, mc_platform_s::syncList, and syncListFind().
Referenced by MC_CondReset_chdl().
Wakes up at least one thread waiting on a condition variable.
Definition at line 598 of file libmc.c.
References syncListNode_s::cond, COND_SIGNAL, syncListNode_s::lock, MC_ERR_NOT_FOUND, agency_s::mc_platform, MUTEX_LOCK, MUTEX_UNLOCK, syncListNode_s::signalled, mc_platform_s::syncList, and syncListFind().
Referenced by MC_CondSignal_chdl().
Wait on a MobileC synchronization variable.
Definition at line 613 of file libmc.c.
References syncListNode_s::cond, COND_WAIT, syncListNode_s::lock, MC_ERR_NOT_FOUND, agency_s::mc_platform, MUTEX_LOCK, MUTEX_UNLOCK, syncListNode_s::signalled, mc_platform_s::syncList, and syncListFind().
Referenced by MC_CondWait_chdl().
Performs a deep-copy of an agent structure.
Definition at line 653 of file libmc.c.
References agent_Copy(), and MC_SUCCESS.
Stop and remove an agent.
Definition at line 660 of file libmc.c.
References CHECK_NULL, MC_ERR_INVALID, MC_SetAgentStatus(), MC_SUCCESS, MC_TerminateAgent(), and MC_WAIT_FINISHED.
Referenced by MC_DeleteAgent_chdl().
Free memory allocated by a Service Search operation.
Definition at line 674 of file libmc.c.
Referenced by MC_DestroyServiceSearchResult_chdl().
End an agency.
Definition at line 723 of file libmc.c.
References mc_platform_s::acc, mc_platform_s::ams, mc_platform_s::cmd_prompt, COND_SIGNAL, mc_platform_s::connection_queue, mc_platform_s::df, GET_THREAD_MODE, agency_s::hostName, agency_s::mc_platform, mc_platform_Destroy(), MC_THREAD_ACC, MC_THREAD_AMS, MC_THREAD_CP, MC_THREAD_DF, mc_platform_s::message_queue, MUTEX_LOCK, MUTEX_UNLOCK, mc_platform_s::quit, mc_platform_s::quit_lock, cmd_prompt_s::thread, THREAD_CANCEL, THREAD_JOIN, and agency_s::threads.
Referenced by MC_End_chdl().
Find an agent by its id.
Definition at line 790 of file libmc.c.
References mc_platform_s::agent_queue, and agency_s::mc_platform.
Referenced by MC_FindAgentByID_chdl().
Find an agent by its name.
Definition at line 777 of file libmc.c.
References mc_platform_s::agent_queue, and agency_s::mc_platform.
Referenced by MC_AclSend(), and MC_FindAgentByName_chdl().
Retrieve an agent's Ch interpreter.
Definition at line 844 of file libmc.c.
References agent_s::agent_interp.
Retrieve an agent's id.
Definition at line 850 of file libmc.c.
References agent_s::id.
Referenced by MC_GetAgentID_chdl().
Definition at line 858 of file libmc.c.
References agent_s::lock, MUTEX_LOCK, MUTEX_UNLOCK, and agent_s::name.
Referenced by MC_GetAgentName_chdl().
Retrive the number of tasks an agent has.
Definition at line 939 of file libmc.c.
References agent_s::datastate, and agent_datastate_s::number_of_tasks.
Referenced by MC_GetAgentNumTasks_chdl().
Get an agent's return data.
Definition at line 876 of file libmc.c.
References agent_task_s::agent_return_data, interpreter_variable_data_s::array_dim, interpreter_variable_data_s::array_extent, CH_DATATYPE_SIZE, interpreter_variable_data_s::data_type, agent_s::datastate, agent_datastate_s::number_of_tasks, size, and agent_datastate_s::tasks.
Get an agent's current status.
Definition at line 822 of file libmc.c.
References agent_s::agent_status, agent_s::lock, MUTEX_LOCK, and MUTEX_UNLOCK.
Referenced by MC_GetAgentStatus_chdl().
Get an agent's type.
Definition at line 945 of file libmc.c.
References agent_s::agent_type.
Get an agent's xml string.
Definition at line 832 of file libmc.c.
References agent_s::datastate, mxmlSaveAllocString(), and agent_datastate_s::xml_agent_root.
Referenced by MC_GetAgentXMLString_chdl().
Halt an agency: Do not process new entries in queues.
Definition at line 991 of file libmc.c.
References mc_platform_s::giant, mc_platform_s::giant_lock, agency_s::mc_platform, MUTEX_LOCK, and MUTEX_UNLOCK.
Referenced by MC_GetAllAgents(), and MC_HaltAgency_chdl().
Initialize and start a MobileC agency.
Definition at line 1000 of file libmc.c.
References CHECK_NULL, agency_s::client, MCAgencyOptions_s::default_agent_status, agency_s::default_agentstatus, MCAgencyOptions_s::enable_security, agency_s::enable_security, HOST_NAME_MAX, agency_s::hostName, MC_InitializeAgencyOptions(), agency_s::mc_platform, mc_platform_Initialize(), MC_THREAD_ALL, agency_s::portno, agency_s::server, MCAgencyOptions_s::stack_size, agency_s::stack_size, MCAgencyOptions_s::threads, and agency_s::threads.
Initialize MobileC options.
Definition at line 1055 of file libmc.c.
References MCAgencyOptions_s::default_agent_status, MCAgencyOptions_s::enable_security, MC_THREAD_ALL, MC_WAIT_CH, MCAgencyOptions_s::modified, MCAgencyOptions_s::stack_size, and MCAgencyOptions_s::threads.
Referenced by MC_Initialize().
Load an agent from a file into an agency.
Definition at line 1072 of file libmc.c.
References buf, agency_s::mc_platform, message_Destroy(), message_InitializeFromString(), message_New(), mc_platform_s::message_queue, MXML_DESCEND, mxmlFindElement(), mxmlLoadString(), message_s::to_address, message_s::xml_payload, and message_s::xml_root.
Wait indefinitely.
Definition at line 1697 of file libmc.c.
References mc_platform_s::ams, and agency_s::mc_platform.
Locks a MobileC synchronization variable as a mutex.
Definition at line 1142 of file libmc.c.
References syncListNode_s::lock, agency_s::mc_platform, MUTEX_LOCK, mc_platform_s::syncList, and syncListFind().
Referenced by MC_MutexLock_chdl().
Definition at line 1154 of file libmc.c.
References syncListNode_s::lock, agency_s::mc_platform, MUTEX_UNLOCK, mc_platform_s::syncList, and syncListFind().
Referenced by MC_MutexUnlock_chdl().
Prints an agents code to stdout.
Definition at line 1166 of file libmc.c.
References agent_datastate_s::agent_code, agent_s::datastate, agent_s::lock, MUTEX_LOCK, MUTEX_UNLOCK, agent_datastate_s::number_of_tasks, and agent_datastate_s::task_progress.
Referenced by MC_PrintAgentCode_chdl().
Register a new service with the Directory Facilitator.
Definition at line 1182 of file libmc.c.
References CHECK_NULL, mc_platform_s::df, df_AddRequest(), df_request_list_node_New(), agent_s::id, MC_ERR_INVALID_ARGS, MC_ERR_MEMORY, agency_s::mc_platform, MUTEX_INIT, MUTEX_T, and agent_s::name.
Referenced by MC_RegisterService_chdl().
Reset a MobileC signal.
Definition at line 1316 of file libmc.c.
References COND_SIGNAL, mc_platform_s::giant, mc_platform_s::giant_cond, mc_platform_s::giant_lock, MC_NO_SIGNAL, agency_s::mc_platform, mc_platform_s::MC_signal, MUTEX_LOCK, and MUTEX_UNLOCK.
Resumes a halted agency.
Definition at line 1261 of file libmc.c.
References mc_platform_s::giant, mc_platform_s::giant_lock, agency_s::mc_platform, MUTEX_LOCK, and MUTEX_UNLOCK.
Referenced by MC_GetAllAgents(), and MC_ResumeAgency_chdl().
Retrieves the oldest agent from an agency.
Definition at line 1270 of file libmc.c.
References mc_platform_s::agent_queue, agent_s::agent_status, ListSearch(), MC_AGENT_NEUTRAL, agency_s::mc_platform, MUTEX_LOCK, and MUTEX_UNLOCK.
Referenced by MC_RetrieveAgent_chdl().
Retrieves an agent's Ch code.
Definition at line 1300 of file libmc.c.
References agent_datastate_s::agent_code, buf, agent_s::datastate, agent_s::lock, MUTEX_LOCK, MUTEX_UNLOCK, and agent_datastate_s::task_progress.
Referenced by MC_RetrieveAgentCode_chdl().
Search the directory facilitator for a service.
Definition at line 1327 of file libmc.c.
References CHECK_NULL, COND_SLEEP_ACTION, mc_platform_s::df, df_AddRequest(), df_request_list_node_Destroy(), df_request_list_node_New(), df_request_search_Destroy(), df_request_search_New(), MC_ERR_MEMORY, agency_s::mc_platform, MC_SUCCESS, and search.
Referenced by MC_SearchForService_chdl().
Post to a MobileC synchronization variable semaphore.
Definition at line 1377 of file libmc.c.
References agency_s::mc_platform, syncListNode_s::sem, SEMAPHORE_POST, mc_platform_s::syncList, and syncListFind().
Referenced by MC_SemaphorePost_chdl().
Decreases a MobileC synchronization variable semaphore count by one.
Definition at line 1389 of file libmc.c.
References agency_s::mc_platform, syncListNode_s::sem, SEMAPHORE_WAIT, mc_platform_s::syncList, and syncListFind().
Referenced by MC_SemaphoreWait_chdl().
Sends an agent migration message.
Definition at line 1411 of file libmc.c.
References MC_ERR, agency_s::mc_platform, message_Destroy(), message_InitializeFromString(), message_New(), and mc_platform_s::message_queue.
Referenced by MC_SendAgentMigrationMessage_chdl().
Sends an agent migration message.
Definition at line 1442 of file libmc.c.
References buf, agency_s::mc_platform, message_Destroy(), message_InitializeFromString(), message_New(), and mc_platform_s::message_queue.
Referenced by handler_SEND(), and MC_SendAgentMigrationMessageFile_chdl().
Set an agent's status.
Definition at line 1528 of file libmc.c.
References agent_s::agent_status, mc_platform_s::ams, COND_SIGNAL, agent_s::lock, agent_s::mc_platform, MUTEX_LOCK, MUTEX_UNLOCK, and agent_s::orphan.
Referenced by MC_DeleteAgent(), and MC_SetAgentStatus_chdl().
Sets default incoming agent status.
Definition at line 1543 of file libmc.c.
References mc_platform_s::default_agentstatus, and agency_s::mc_platform.
Referenced by MC_SetDefaultAgentStatus_chdl().
Sets a MobileC thread to "off" status.
Definition at line 1570 of file libmc.c.
References SET_THREAD_OFF, and MCAgencyOptions_s::threads.
Sets a MobileC thread to "on" status.
Definition at line 1553 of file libmc.c.
References SET_THREAD_ON, and MCAgencyOptions_s::threads.
Set all MobileC threads to 'off' status.
Definition at line 1577 of file libmc.c.
References MC_THREAD_ALL, SET_THREAD_OFF, and MCAgencyOptions_s::threads.
Set all Mobile-C threads on.
Definition at line 1560 of file libmc.c.
References MC_THREAD_ALL, SET_THREAD_ON, and MCAgencyOptions_s::threads.
Set up a steerable algorithm.
Definition at line 1587 of file libmc.c.
References agency_s::mc_platform, MC_RESTART, MC_RUN, mc_platform_s::MC_steer_command, mc_platform_s::MC_steer_lock, MUTEX_LOCK, and MUTEX_UNLOCK.
The MobileC user-algorithm steering function.
Definition at line 1606 of file libmc.c.
References COND_WAIT, mc_platform_s::MC_steer_command, mc_platform_s::MC_steer_cond, mc_platform_s::MC_steer_lock, MC_SUSPEND, MUTEX_LOCK, and MUTEX_UNLOCK.
Deletes a previously initialized synchronization variable.
Definition at line 1622 of file libmc.c.
References syncList_s::giant_lock, syncListNode_s::lock, MC_ERR_NOT_FOUND, agency_s::mc_platform, MUTEX_LOCK, MUTEX_UNLOCK, mc_platform_s::syncList, syncListFind(), syncListNodeDestroy(), and syncListRemove().
Referenced by MC_SyncDelete_chdl().
Initializes a new MobileC synchronization variable.
Definition at line 1652 of file libmc.c.
References syncList_s::giant_lock, syncListNode_s::id, agency_s::mc_platform, MUTEX_LOCK, MUTEX_UNLOCK, node, mc_platform_s::syncList, syncListAddNode(), syncListFind(), and syncListNodeNew().
Referenced by MC_SyncInit_chdl().
Halt a running agent.
Definition at line 1677 of file libmc.c.
References agent_s::agent_interp.
Referenced by MC_DeleteAgent(), and MC_TerminateAgent_chdl().
Wait indefinitely.
This function blocks until an agent arrival signal is triggered, at which point in unblocks.
Definition at line 1704 of file libmc.c.
References mc_platform_s::agent_queue, COND_WAIT, mc_platform, agency_s::mc_platform, MUTEX_LOCK, MUTEX_UNLOCK, and size.
Wait and retrieve an agent.
Definition at line 1724 of file libmc.c.
References mc_platform_s::agent_queue, ListSearch(), agency_s::mc_platform, MC_RECV_AGENT, MC_WaitSignal(), MUTEX_LOCK, and MUTEX_UNLOCK.
Wait for a MobileC signal.
Definition at line 1742 of file libmc.c.
References COND_WAIT, mc_platform_s::giant, mc_platform_s::giant_lock, agency_s::mc_platform, mc_platform_s::MC_signal, mc_platform_s::MC_signal_cond, mc_platform_s::MC_signal_lock, MUTEX_LOCK, and MUTEX_UNLOCK.
Referenced by MC_WaitRetrieveAgent().