c_source/proos_api/proos.h File Reference

ProOS TCP/IP Communication API. More...


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.


Detailed Description

ProOS TCP/IP Communication API.

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 Documentation

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)


Function Documentation

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.

Parameters:
id Id of the variable you want to register.
len Size of the memory you'd like to register.
Returns:
Address of allocated memory on BOSS. 0 if failed.

unsigned char proos_connect ( const char *  address,
const unsigned int  port 
)

Connect with BOSS.

Connect with the BOSS over TCP/IP.

Parameters:
address String network address of the BOSS machine.
port Integer port number of the BOSS machine.
Returns:
0x01 if connected, 0x00 if failed.

unsigned char proos_disconnect ( void   ) 

Disconnect from BOSS.

Connect from BOSS over TCP/IP.

Returns:
0x01 if disconnected, 0x00 if failed.

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.

Parameters:
id Id of the variable you want to unregister.
Returns:
0x01 if free success, 0x00 if failed.

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.

Returns:
Local client number. 0 if not registered.

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.

Parameters:
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.
Returns:
0x01 if read success, 0x00 if failed.

unsigned char proos_register ( void   ) 

Register with BOSS.

Be sure to run proos_connect() first.

Returns:
0x01 if registered, 0x00 if failed.

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.

Parameters:
sem_id Semaphore ID to send P() request at.
Returns:
0x01 if success, 0x00 if failed.

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.

Parameters:
sem_id Unique semaphore ID to register at the BOSS.
sem_val The intial value to use when registering the semaphore.
Returns:
0x01 if success, 0x00 if failed.

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.

Parameters:
sem_id Semaphore ID to unregister.
Returns:
0x01 if success, 0x00 if failed.

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.

Parameters:
sem_id Semaphore ID to send V() request at.
Returns:
0x01 if success, 0x00 if failed.

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.

Parameters:
msg Null terminated string containing your message.
Returns:
0x01 if success, 0x00 if failed.

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().

Returns:
0x01 if disconnected, 0x00 if failed.

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.

Parameters:
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.
Returns:
0x01 if write is success, 0x00 if failed.


Generated on Wed Apr 4 14:11:07 2007 for ProOS MUTS TCP/IP API by  doxygen 1.5.1