2006-08-23 03:32:36 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2005-01-12 20:51:34 +00:00
|
|
|
#ifndef _IOF_BASE_ENDPOINT_
|
|
|
|
#define _IOF_BASE_ENDPOINT_
|
|
|
|
|
2006-02-12 01:33:29 +00:00
|
|
|
#include "orte_config.h"
|
2005-07-03 16:22:16 +00:00
|
|
|
#include "opal/class/opal_list.h"
|
2005-07-03 23:09:55 +00:00
|
|
|
#include "opal/event/event.h"
|
2006-02-12 01:33:29 +00:00
|
|
|
#include "orte/mca/iof/iof.h"
|
|
|
|
#include "orte/mca/iof/base/iof_base_header.h"
|
2005-01-12 20:51:34 +00:00
|
|
|
|
2006-08-23 03:32:36 +00:00
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2005-01-12 20:51:34 +00:00
|
|
|
|
2005-11-10 04:49:51 +00:00
|
|
|
/**
|
|
|
|
* Structure store callbacks
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct orte_iof_base_callback_t {
|
|
|
|
opal_list_item_t super;
|
|
|
|
orte_iof_base_callback_fn_t cb_func;
|
|
|
|
void* cb_data;
|
|
|
|
};
|
|
|
|
typedef struct orte_iof_base_callback_t orte_iof_base_callback_t;
|
|
|
|
|
2006-08-23 03:32:36 +00:00
|
|
|
ORTE_DECLSPEC OBJ_CLASS_DECLARATION(orte_iof_base_callback_t);
|
2005-11-10 04:49:51 +00:00
|
|
|
|
2005-01-13 15:27:28 +00:00
|
|
|
/**
|
|
|
|
* Structure that represents a published endpoint.
|
|
|
|
*/
|
|
|
|
|
2005-03-14 20:57:21 +00:00
|
|
|
struct orte_iof_base_endpoint_t {
|
2005-07-03 16:22:16 +00:00
|
|
|
opal_list_item_t super;
|
2005-03-14 20:57:21 +00:00
|
|
|
orte_iof_base_mode_t ep_mode;
|
|
|
|
orte_process_name_t ep_name;
|
2005-01-12 20:51:34 +00:00
|
|
|
int ep_tag;
|
|
|
|
int ep_fd;
|
|
|
|
uint32_t ep_seq;
|
|
|
|
uint32_t ep_ack;
|
2005-07-03 23:09:55 +00:00
|
|
|
opal_event_t ep_event;
|
2006-02-04 23:26:58 +00:00
|
|
|
opal_event_t ep_stdin_event;
|
2005-07-03 16:22:16 +00:00
|
|
|
opal_list_t ep_frags;
|
2005-11-10 04:49:51 +00:00
|
|
|
opal_list_t ep_callbacks;
|
2005-01-12 20:51:34 +00:00
|
|
|
};
|
2005-03-14 20:57:21 +00:00
|
|
|
typedef struct orte_iof_base_endpoint_t orte_iof_base_endpoint_t;
|
2005-01-12 20:51:34 +00:00
|
|
|
|
2006-08-23 03:32:36 +00:00
|
|
|
ORTE_DECLSPEC OBJ_CLASS_DECLARATION(orte_iof_base_endpoint_t);
|
2005-01-12 20:51:34 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Diff between two sequence numbers allowing for rollover
|
|
|
|
*/
|
|
|
|
|
2005-03-14 20:57:21 +00:00
|
|
|
#define ORTE_IOF_BASE_SEQDIFF(s1,s2) \
|
2005-10-18 14:26:12 +00:00
|
|
|
((s1 >= s2) ? (s1 - s2) : (s1 + (ULONG_MAX - s2)))
|
2005-01-12 20:51:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2005-01-13 15:27:28 +00:00
|
|
|
* Create a local endpoint.
|
|
|
|
*
|
|
|
|
* @param name Process name corresponding to endpoint.
|
|
|
|
* @param mode Source or sink of data (exclusive).
|
|
|
|
* @param tag Logical tag for matching.
|
|
|
|
* @aram fd Local file descriptor corresponding to endpoint.
|
2005-01-12 20:51:34 +00:00
|
|
|
*/
|
|
|
|
|
2006-08-23 03:32:36 +00:00
|
|
|
ORTE_DECLSPEC int orte_iof_base_endpoint_create(
|
2005-03-14 20:57:21 +00:00
|
|
|
const orte_process_name_t* name,
|
|
|
|
orte_iof_base_mode_t mode,
|
2005-01-12 20:51:34 +00:00
|
|
|
int tag,
|
|
|
|
int fd);
|
|
|
|
|
2005-11-10 04:49:51 +00:00
|
|
|
/**
|
|
|
|
* Associate a callback on receipt of data.
|
|
|
|
*
|
|
|
|
* @param name Process name corresponding to endpoint.
|
|
|
|
* @param cbfunc Logical tag for matching.
|
|
|
|
* @aram cbdata Local file descriptor corresponding to endpoint.
|
|
|
|
*/
|
|
|
|
|
2006-08-23 03:32:36 +00:00
|
|
|
ORTE_DECLSPEC int orte_iof_base_callback_create(
|
2005-11-10 04:49:51 +00:00
|
|
|
const orte_process_name_t *name,
|
|
|
|
int tag,
|
|
|
|
orte_iof_base_callback_fn_t cbfunc,
|
|
|
|
void* cbdata);
|
|
|
|
|
2006-08-23 03:32:36 +00:00
|
|
|
ORTE_DECLSPEC int orte_iof_base_callback_delete(
|
2005-11-10 04:49:51 +00:00
|
|
|
const orte_process_name_t *name,
|
|
|
|
int tag);
|
|
|
|
|
|
|
|
|
2005-01-12 20:51:34 +00:00
|
|
|
/**
|
2005-01-13 15:27:28 +00:00
|
|
|
* Delete all local endpoints matching the specified
|
|
|
|
* name/mask/tag parameters.
|
2005-01-12 20:51:34 +00:00
|
|
|
*
|
2005-01-13 15:27:28 +00:00
|
|
|
* @paran name Process name corresponding to one or more endpoint(s).
|
|
|
|
* @param mask Mask used for name comparisons.
|
|
|
|
* @param tag Tag for matching endpoints.
|
2005-01-12 20:51:34 +00:00
|
|
|
*/
|
|
|
|
|
2006-08-23 03:32:36 +00:00
|
|
|
ORTE_DECLSPEC int orte_iof_base_endpoint_delete(
|
2005-03-14 20:57:21 +00:00
|
|
|
const orte_process_name_t* name,
|
|
|
|
orte_ns_cmp_bitmask_t mask,
|
2005-01-12 20:51:34 +00:00
|
|
|
int tag);
|
|
|
|
|
2005-01-13 15:27:28 +00:00
|
|
|
/**
|
|
|
|
* Disable forwarding through the specified endpoint.
|
2005-01-12 20:51:34 +00:00
|
|
|
*/
|
|
|
|
|
2006-08-23 03:32:36 +00:00
|
|
|
ORTE_DECLSPEC int orte_iof_base_endpoint_close(
|
2005-03-14 20:57:21 +00:00
|
|
|
orte_iof_base_endpoint_t* endpoint);
|
2005-01-12 20:51:34 +00:00
|
|
|
|
|
|
|
/**
|
2005-01-13 15:27:28 +00:00
|
|
|
* Attempt to match an endpoint based on the destination
|
|
|
|
* process name/mask/tag.
|
2005-01-12 20:51:34 +00:00
|
|
|
*/
|
|
|
|
|
2006-08-23 03:32:36 +00:00
|
|
|
ORTE_DECLSPEC orte_iof_base_endpoint_t* orte_iof_base_endpoint_match(
|
2005-03-14 20:57:21 +00:00
|
|
|
const orte_process_name_t* dst_name,
|
|
|
|
orte_ns_cmp_bitmask_t dst_mask,
|
2005-01-12 20:51:34 +00:00
|
|
|
int dst_tag);
|
|
|
|
|
|
|
|
/**
|
2005-01-13 15:27:28 +00:00
|
|
|
* Forward the specified message out the endpoint.
|
2005-01-12 20:51:34 +00:00
|
|
|
*/
|
|
|
|
|
2006-08-23 03:32:36 +00:00
|
|
|
ORTE_DECLSPEC int orte_iof_base_endpoint_forward(
|
2005-03-14 20:57:21 +00:00
|
|
|
orte_iof_base_endpoint_t* endpoint,
|
|
|
|
const orte_process_name_t* src,
|
|
|
|
orte_iof_base_msg_header_t* hdr,
|
2005-01-12 20:51:34 +00:00
|
|
|
const unsigned char* data);
|
|
|
|
|
|
|
|
/*
|
2005-01-13 15:27:28 +00:00
|
|
|
* Callback when peer has closed endpoint.
|
2005-01-12 20:51:34 +00:00
|
|
|
*/
|
|
|
|
|
2006-08-23 03:32:36 +00:00
|
|
|
ORTE_DECLSPEC void orte_iof_base_endpoint_closed(
|
2005-03-14 20:57:21 +00:00
|
|
|
orte_iof_base_endpoint_t* endpoint);
|
2005-01-12 20:51:34 +00:00
|
|
|
|
|
|
|
/**
|
2005-01-13 15:27:28 +00:00
|
|
|
* Callback when the specified sequence has been
|
|
|
|
* acknowledged.
|
2005-01-12 20:51:34 +00:00
|
|
|
*/
|
2005-01-13 15:27:28 +00:00
|
|
|
|
2006-08-23 03:32:36 +00:00
|
|
|
ORTE_DECLSPEC int orte_iof_base_endpoint_ack(
|
2005-03-14 20:57:21 +00:00
|
|
|
orte_iof_base_endpoint_t* endpoint,
|
2005-01-12 20:51:34 +00:00
|
|
|
uint32_t seq);
|
|
|
|
|
2005-01-14 00:11:24 +00:00
|
|
|
/**
|
|
|
|
* Check for pending I/O
|
|
|
|
*/
|
|
|
|
|
2005-03-14 20:57:21 +00:00
|
|
|
static inline bool orte_iof_base_endpoint_pending(
|
|
|
|
orte_iof_base_endpoint_t* endpoint)
|
2005-01-14 00:11:24 +00:00
|
|
|
{
|
2005-07-03 16:22:16 +00:00
|
|
|
return opal_list_get_size(&endpoint->ep_frags) || (endpoint->ep_seq != endpoint->ep_ack);
|
2005-01-14 00:11:24 +00:00
|
|
|
}
|
|
|
|
|
2006-08-23 03:32:36 +00:00
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-01-12 20:51:34 +00:00
|
|
|
#endif
|
|
|
|
|