Data Structures | |
struct | proos_packet |
ProOS Communication Packet. More... | |
Typedefs | |
typedef unsigned int | proos_address |
typedef short unsigned int | proos_semid |
Functions | |
unsigned char | proos_connect (const char *address, const unsigned int port) |
Connect with BOSS. | |
unsigned char | proos_disconnect (void) |
Disconnect from BOSS. | |
unsigned char | proos_register (void) |
Register with BOSS. | |
unsigned char | proos_unregister (void) |
Register with BOSS. | |
proos_address | proos_alloc (const proos_address id, const unsigned char len) |
Allocate shared memory with BOSS. | |
unsigned char | proos_free (const proos_address id) |
Free shared memory with BOSS. | |
unsigned char | proos_write (const proos_address address, const char *data, const unsigned char len) |
Write value to shared address on BOSS. | |
unsigned char | proos_read (const proos_address address, const char *data, const unsigned char len) |
Read value from shared address on BOSS. | |
unsigned char | proos_sem_register (const proos_semid sem_id, const unsigned char sem_val) |
Register semaphore with BOSS. | |
unsigned char | proos_sem_unregister (const proos_semid sem_id) |
Unregister semaphore with BOSS. | |
unsigned char | proos_sem_p (const proos_semid sem_id) |
Send P() semaphoric request to the BOSS. | |
unsigned char | proos_sem_v (const proos_semid sem_id) |
Send V() semaphoric request to the BOSS. | |
unsigned char | proos_sendmsg (const char *msg) |
Send message to the BOSS to be printed on it's terminal window. | |
unsigned char | proos_get_client_number (void) |
Get the local client number for MUTS debug purposes. |
ProOS API for MUTS software development. Including networking, memory management and protocol handling.
This only works on little-endian architectures.
Using the following headers on Linux:
And these on Windows:
typedef unsigned int proos_address |
32-bit offset address for malloc. Addresses can always be incremented to match a certain offset within regged memory. (typedef for portability to 80515)
typedef short unsigned int proos_semid |
16-bit semaphore number. (typedef for portability to 80515)
proos_address proos_alloc | ( | const proos_address | id, | |
const unsigned char | len | |||
) |
Allocate shared memory with BOSS.
Two MUTS machines using the same ID to register share that part of memory. If the size doesn't match the preregistered ID this request will fail.
id | Id of the variable you want to register. | |
len | Size of the memory you'd like to register. |
unsigned char proos_connect | ( | const char * | address, | |
const unsigned int | port | |||
) |
Connect with BOSS.
Connect with the BOSS over TCP/IP.
address | String network address of the BOSS machine. | |
port | Integer port number of the BOSS machine. |
unsigned char proos_disconnect | ( | void | ) |
Disconnect from BOSS.
Connect from BOSS over TCP/IP.
unsigned char proos_free | ( | const proos_address | id | ) |
Free shared memory with BOSS.
Free allocated memory on the BOSS. If the memory is still in use by another MUTS it only revokes your access rights to the memory block.
id | Id of the variable you want to unregister. |
unsigned char proos_get_client_number | ( | void | ) |
Get the local client number for MUTS debug purposes.
Do not use this in API functions, it has a global instead.
unsigned char proos_read | ( | const proos_address | address, | |
const char * | data, | |||
const unsigned char | len | |||
) |
Read value from shared address on BOSS.
The address has to be a product of proos_alloc() plus the wanted offset in that memory block.
address | Address of memory you want to read from the BOSS. | |
data | Pointer to pre-allocated local data buffer where the data should go. | |
len | Length of data to read from the BOSS shared address. |
unsigned char proos_register | ( | void | ) |
Register with BOSS.
Be sure to run proos_connect() first.
unsigned char proos_sem_p | ( | const proos_semid | sem_id | ) |
Send P() semaphoric request to the BOSS.
This is according to the theory by Dijkstra.
sem_id | Semaphore ID to send P() request at. |
unsigned char proos_sem_register | ( | const proos_semid | sem_id, | |
const unsigned char | sem_val | |||
) |
Register semaphore with BOSS.
Be sure this semaphore doesn't exist yet if you don't want it to beforehand. The protocol does not support availability queries or lowest increment registering.
sem_id | Unique semaphore ID to register at the BOSS. | |
sem_val | The intial value to use when registering the semaphore. |
unsigned char proos_sem_unregister | ( | const proos_semid | sem_id | ) |
Unregister semaphore with BOSS.
This is also automatically done at unregister, you don't have to do this at the end of your program.
sem_id | Semaphore ID to unregister. |
unsigned char proos_sem_v | ( | const proos_semid | sem_id | ) |
Send V() semaphoric request to the BOSS.
This is according to the theory by Dijkstra.
sem_id | Semaphore ID to send V() request at. |
unsigned char proos_sendmsg | ( | const char * | msg | ) |
Send message to the BOSS to be printed on it's terminal window.
Your MUTS client number will be displayed in front of your message.
msg | Null terminated string containing your message. |
unsigned char proos_unregister | ( | void | ) |
Register with BOSS.
This will cause all memory to be freed not in use by any MUTS. Be sure to run this BEFORE proos_disconnect().
unsigned char proos_write | ( | const proos_address | address, | |
const char * | data, | |||
const unsigned char | len | |||
) |
Write value to shared address on BOSS.
The address has to be a product of proos_alloc() plus the wanted offset in that memory block.
address | Address of memory you want to write to on the BOSS. | |
data | Pointer to the local data buffer where your data resides. | |
len | Length of data to read from the local data buffer. |