JULEA
Data Structures | Macros | Typedefs | Enumerations | Functions
Network

Data Structures

struct  JNetworkConnectionMemory
 
struct  JNetworkConnectionMemoryID
 
struct  JNetworkFabricAddr
 
struct  JNetworkFabric
 
struct  JNetworkConnection
 

Macros

#define KEY_MIN   1
 
#define J_NETWORK_CONNECTION_MAX_SEND   2
 
#define J_NETWORK_CONNECTION_MAX_RECV   1
 
#define EXE(cmd, ...)
 
#define CHECK(msg)
 
#define G_CHECK(msg)
 

Typedefs

typedef struct JNetworkConnection JNetworkConnection
 
typedef enum JNetworkConnectionAck JNetworkConnectionAck
 
typedef struct JNetworkConnectionMemory JNetworkConnectionMemory
 
typedef struct JNetworkConnectionMemoryID JNetworkConnectionMemoryID
 
typedef struct JNetworkFabric JNetworkFabric
 
typedef struct JNetworkFabricAddr JNetworkFabricAddr
 
typedef enum JNetworkFabricSide JNetworkFabricSide
 
typedef enum JNetworkFabricEvents JNetworkFabricEvents
 
typedef enum JNetworkConnectionEvents JNetworkConnectionEvents
 

Enumerations

enum  JNetworkConnectionAck { J_NETWORK_CONNECTION_ACK = 42 }
 
enum  JNetworkFabricSide { JF_SERVER , JF_CLIENT }
 
enum  JNetworkFabricEvents { J_FABRIC_EVENT_ERROR = 0 , J_FABRIC_EVENT_TIMEOUT , J_FABRIC_EVENT_CONNECTION_REQUEST , J_FABRIC_EVENT_SHUTDOWN }
 
enum  JNetworkConnectionEvents { J_CONNECTION_EVENT_ERROR = 0 , J_CONNECTION_EVENT_TIMEOUT , J_CONNECTION_EVENT_CONNECTED , J_CONNECTION_EVENT_SHUTDOWN }
 

Functions

G_END_DECLS G_BEGIN_DECLS JNetworkFabricj_network_fabric_init_server (JConfiguration *configuration)
 
gboolean j_network_connection_memory_get_id (JNetworkConnectionMemory *this, JNetworkConnectionMemoryID *id)
 
JNetworkConnectionj_network_connection_init_client (JConfiguration *configuration, JBackendType backend, guint index)
 
JNetworkConnectionj_network_connection_init_server (JNetworkFabric *fabric, GSocketConnection *gconnection)
 
gboolean j_network_connection_fini (JNetworkConnection *connection)
 
gboolean j_network_connection_send (JNetworkConnection *connection, gpointer data, gsize length)
 
gboolean j_network_connection_recv (JNetworkConnection *connection, gsize length, gpointer data)
 
gboolean j_network_connection_rma_read (JNetworkConnection *connection, JNetworkConnectionMemoryID const *memory_id, gpointer data)
 
gboolean j_network_connection_wait_for_completion (JNetworkConnection *connection)
 
gboolean j_network_connection_closed (JNetworkConnection *connection)
 
gboolean j_network_connection_rma_register (JNetworkConnection *connection, gconstpointer data, gsize length, JNetworkConnectionMemory *handle)
 
gboolean j_network_connection_rma_unregister (JNetworkConnection *connection, JNetworkConnectionMemory *handle)
 

Detailed Description

Todo:
update to JULEA style
Todo:
update to JULEA style

Macro Definition Documentation

◆ CHECK

#define CHECK (   msg)
Value:
do \
{ \
if (res < 0) \
{ \
g_warning("%s: " msg "\t(%s:%d)\nDetails:\t%s", "??TODO??", __FILE__, __LINE__, fi_strerror(-res)); \
goto end; \
} \
} while (FALSE)

◆ EXE

#define EXE (   cmd,
  ... 
)
Value:
do \
{ \
if ((cmd) == FALSE) \
{ \
g_warning(__VA_ARGS__); \
goto end; \
} \
} while (FALSE)

◆ G_CHECK

#define G_CHECK (   msg)
Value:
do \
{ \
if (error != NULL) \
{ \
g_warning(msg "\n\tWith:%s", error->message); \
g_error_free(error); \
goto end; \
} \
} while (FALSE)

◆ J_NETWORK_CONNECTION_MAX_RECV

#define J_NETWORK_CONNECTION_MAX_RECV   1

◆ J_NETWORK_CONNECTION_MAX_SEND

#define J_NETWORK_CONNECTION_MAX_SEND   2

◆ KEY_MIN

#define KEY_MIN   1

Typedef Documentation

◆ JNetworkConnection

◆ JNetworkConnectionAck

◆ JNetworkConnectionEvents

◆ JNetworkConnectionMemory

◆ JNetworkConnectionMemoryID

◆ JNetworkFabric

◆ JNetworkFabricAddr

◆ JNetworkFabricEvents

◆ JNetworkFabricSide

Enumeration Type Documentation

◆ JNetworkConnectionAck

Acknowledgment value. Value used to send an ack for any reason. May be used to verify that the remote memory was successful read.

Enumerator
J_NETWORK_CONNECTION_ACK 

◆ JNetworkConnectionEvents

Possible events for paired connections.

Enumerator
J_CONNECTION_EVENT_ERROR 

An error was reported, the connection is probably in an invalid state!

J_CONNECTION_EVENT_TIMEOUT 

There was no event to read in the given time frame.

J_CONNECTION_EVENT_CONNECTED 

First event after successful established connection.

J_CONNECTION_EVENT_SHUTDOWN 

Connection was closed.

◆ JNetworkFabricEvents

Possible events for listening fabrics

Enumerator
J_FABRIC_EVENT_ERROR 

An error was reported, fabric is probably in a invalid state!

J_FABRIC_EVENT_TIMEOUT 

No event received in the given time frame.

J_FABRIC_EVENT_CONNECTION_REQUEST 

A connection request was received.

J_FABRIC_EVENT_SHUTDOWN 

Fabric socket was closed.

◆ JNetworkFabricSide

Flag used to different between client and server fabric.

Enumerator
JF_SERVER 
JF_CLIENT 

Function Documentation

◆ j_network_connection_closed()

gboolean j_network_connection_closed ( JNetworkConnection connection)

Check if the connection was closed by the other party.

◆ j_network_connection_fini()

gboolean j_network_connection_fini ( JNetworkConnection connection)

Closes a connection and free all related resources. * If this an client side connection with private fabric, it will also clear the fabric.

Todo:
params
Returns
TRUE on success, FALSE if an error occurred.

◆ j_network_connection_init_client()

JNetworkConnection * j_network_connection_init_client ( JConfiguration configuration,
JBackendType  backend,
guint  index 
)

Builds a direct connection to an active fabric.

This constructor will fetch the fabric address via TCP and then build a paired connection to this, which later allows for messaging and RMA data transfer. This will also construct a fabric for that connection, which is freed when the connection is finished.

Attention
This function may reduce j_configuration_max_operation_size according to network capabilities.
msc_inline_mscgraph_1
Connection process
Parameters
[in]configurationA configuration.
[in]backendA backend type.
[in]indexAn index.
Returns
A network connection on success, NULL if an error occurred.
Todo:
clean up connection

◆ j_network_connection_init_server()

JNetworkConnection * j_network_connection_init_server ( JNetworkFabric fabric,
GSocketConnection *  gconnection 
)

Establish connection to client based on established GSocketConnection. The GSocketConnection will be used to send the server fabric data. For the connection process see j_network_connection_init_client().

Attention
This function may reduces j_configuration_max_operation_size according to network capabilities.
Parameters
[in]fabricFabric via which the connection should be established.
[in]connectionGSocketConnection for address exchange.
Returns
A new connection on success, NULL if an error occurred.
Todo:
clean up connection

◆ j_network_connection_memory_get_id()

gboolean j_network_connection_memory_get_id ( JNetworkConnectionMemory this,
JNetworkConnectionMemoryID id 
)

Gets identifier of memory region.

Parameters
thisA memory region.
[out]idID of registered memory.
Returns
TRUE on success, FALSE if an error occurred.

◆ j_network_connection_recv()

gboolean j_network_connection_recv ( JNetworkConnection connection,
gsize  length,
gpointer  data 
)

Asynchronously receives data via MSG connection. Asynchronously receive a message. To wait for completion, use j_network_connection_wait_for_completion().

Attention
It is only allowed to have J_CONNECTION_MAX_RECV receive operations pending at the same time. Each has a maximum size of j_configuration_max_operation_size() (the connection initialization may change this value).
Parameters
[in]connectionA connection.
[in]lengthA length in bytes.
[out]dataA data buffer to receive into.
Returns
TRUE on success, FALSE if an error occurred.

◆ j_network_connection_rma_read()

gboolean j_network_connection_rma_read ( JNetworkConnection connection,
JNetworkConnectionMemoryID const *  memory_id,
gpointer  data 
)

Asynchronous direct memory read. Initiate an direct memory read. To wait for completion, use j_network_connection_wait_for_completion().

Todo:
evaluate if paralisation possible
Parameters
[in]connectionA connection.
[in]memory_idA memory ID for the segment that should be copied.
[out]dataA data buffer to receive into.
Returns
TRUE on success, FALSE if an error occurred.
Todo:
static? thread-safety
Todo:
evaluate: only wait for partcial finished jobs

◆ j_network_connection_rma_register()

gboolean j_network_connection_rma_register ( JNetworkConnection connection,
gconstpointer  data,
gsize  length,
JNetworkConnectionMemory handle 
)

Registers memory to make it RMA-readable. Memory access rights must changed to allow for an RMA read by the other party. Therefore, before a j_network_connection_rma_read() can succeed, the provider of the data must register the memory first!

Parameters
[in]connectionA connection.
[in]dataA data buffer to share.
[in]lengthA length in bytes.
[out]handleA handle for the memory region to unregister with j_network_connection_rma_unregister().
Returns
TRUE on success, FALSE if an error occurred.

◆ j_network_connection_rma_unregister()

gboolean j_network_connection_rma_unregister ( JNetworkConnection connection,
JNetworkConnectionMemory handle 
)

Unregisters memory from RMA availablity. Counterpart to j_network_connection_rma_register().

Parameters
[in]connectionA connection.
[in]handleA handle for the memory region to unregister.
Returns
TRUE on success, FALSE if an error occurred.

◆ j_network_connection_send()

gboolean j_network_connection_send ( JNetworkConnection connection,
gpointer  data,
gsize  length 
)

Async send data via MSG connection. Asynchronously sends a message. To recognize completion, use j_network_connection_wait_for_completion(). If the message is small enough it can be injected to the network, in that case the actions finishes immediately (j_network_connection_wait_for_completion() still works).

Todo:

feedback if message was injected

make data a gconstpointer if possible

Attention
It is only allowed to have J_CONNECTION_MAX_SEND send operations pending at the same time. Each has a maximum size of j_configuration_max_operation_size() (the connection initialization may change this value).
Parameters
[in]connectionA connection.
[in]dataA data buffer to send.
[in]lengthA length in bytes.
Returns
TRUE on success, FALSE if an error occurred.

◆ j_network_connection_wait_for_completion()

gboolean j_network_connection_wait_for_completion ( JNetworkConnection connection)

Waits until operations initiated at his connection finished.

Attention
FALSE if waiting finished. This may occur if the connection was closed. Check this with j_connection_active().
Todo:
params
Returns
TRUE on success, FALSE if an error occurred.

◆ j_network_fabric_init_server()

JNetworkFabric * j_network_fabric_init_server ( JConfiguration configuration)

Initializes a fabric for the server side. In difference to j_network_fabric_init_client, the resulting fabric is capable of reciving connection requests. Therefore, events can be read via j_fabric_sread_event.

Parameters
[in]configurationA configuration.
Returns
A new fabric on success, NULL if an error occurred.
Todo:
deduplicate FI_VERSION and hints initialization
Todo:
allow setting provider
Todo:
clean up fabric