The closed process group API

## Functions

cs_error_t | cpg_initialize (cpg_handle_t *handle, cpg_callbacks_t *callbacks)
| Create a new cpg connection.
cs_error_t | cpg_model_initialize (cpg_handle_t *handle, cpg_model_t model, cpg_model_data_t *model_data, void *context)
| Create a new cpg connection, initialize with model.
cs_error_t | cpg_finalize (cpg_handle_t handle)
| Close the cpg handle.
cs_error_t | cpg_fd_get (cpg_handle_t handle, int *fd)
| Get a file descriptor on which to poll.
cs_error_t | cpg_max_atomic_msgsize_get (cpg_handle_t handle, uint32_t *size)
| Get maximum size of a message that will not be fragmented.
cs_error_t | cpg_context_get (cpg_handle_t handle, void **context)
| Get contexts for a CPG handle.
cs_error_t | cpg_context_set (cpg_handle_t handle, void *context)
| Set contexts for a CPG handle.
cs_error_t | cpg_dispatch (cpg_handle_t handle, cs_dispatch_flags_t dispatch_types)
| Dispatch messages and configuration changes.
cs_error_t | cpg_join (cpg_handle_t handle, const struct cpg_name *group)
| Join one or more groups.
cs_error_t | cpg_leave (cpg_handle_t handle, const struct cpg_name *group)
| Leave one or more groups.
cs_error_t | cpg_membership_get (cpg_handle_t handle, struct cpg_name *group_name, struct cpg_address *member_list, int *member_list_entries)
| Get membership information from cpg.
cs_error_t | cpg_local_get (cpg_handle_t handle, unsigned int *local_nodeid)
| cpg_local_get
cs_error_t | cpg_flow_control_state_get (cpg_handle_t handle, cpg_flow_control_state_t *flow_control_state)
| cpg_flow_control_state_get
cs_error_t | cpg_zcb_alloc (cpg_handle_t handle, size_t size, void **buffer)
| cpg_zcb_alloc
cs_error_t | cpg_zcb_free (cpg_handle_t handle, void *buffer)
| cpg_zcb_free
cs_error_t | cpg_zcb_mcast_joined (cpg_handle_t handle, cpg_guarantee_t guarantee, void *msg, size_t msg_len)
| cpg_zcb_mcast_joined
cs_error_t | cpg_mcast_joined (cpg_handle_t handle, cpg_guarantee_t guarantee, const struct iovec *iovec, unsigned int iov_len)
| Multicast to groups joined with cpg_join.
cs_error_t | cpg_iteration_initialize (cpg_handle_t handle, cpg_iteration_type_t iteration_type, const struct cpg_name *group, cpg_iteration_handle_t *cpg_iteration_handle)
| cpg_iteration_initialize
cs_error_t | cpg_iteration_next (cpg_iteration_handle_t handle, struct cpg_iteration_description_t *description)
| cpg_iteration_next
cs_error_t | cpg_iteration_finalize (cpg_iteration_handle_t handle)
| cpg_iteration_finalize

## Detailed Description

## Function Documentation

## cpg_context_get()

cs_error_t cpg_context_get | ( | cpg_handle_t | handle,
|  | void ** | context )

Get contexts for a CPG handle.

Parameters

  handle |
  context |

Returns

Definition at line 332 of file lib/cpg.c.

References cpg_inst::context, CS_OK, and hdb_error_to_cs().

## cpg_context_set()

cs_error_t cpg_context_set | ( | cpg_handle_t | handle,
|  | void * | context )

Set contexts for a CPG handle.

Parameters

  handle |
  context |

Returns

Definition at line 351 of file lib/cpg.c.

References cpg_inst::context, CS_OK, and hdb_error_to_cs().

## cpg_dispatch()

cs_error_t cpg_dispatch | ( | cpg_handle_t | handle,
|  | cs_dispatch_flags_t | dispatch_types )

Dispatch messages and configuration changes.

Parameters

  handle |
  dispatch_types |

Returns

Definition at line 370 of file lib/cpg.c.

References cpg_assembly_data::assembly_buf, cpg_assembly_data::assembly_buf_ptr, cpg_inst::assembly_list_head, cpg_inst::c, cpg_model_v1_data_t::cpg_confchg_fn, cpg_model_v1_data_t::cpg_deliver_fn, CPG_MEMBERS_MAX, CPG_MODEL_V1, cpg_model_v1_data_t::cpg_totem_confchg_fn, CS_DISPATCH_ALL, CS_DISPATCH_ONE, CS_DISPATCH_ONE_NONBLOCKING, CS_ERR_BAD_HANDLE, CS_ERR_LIBRARY, CS_ERR_NO_MEMORY, CS_ERR_TRY_AGAIN, CS_OK, cpg_inst::finalize, hdb_error_to_cs(), IPC_DISPATCH_SIZE, LIBCPG_PARTIAL_FIRST, LIBCPG_PARTIAL_LAST, cpg_assembly_data::list, res_lib_cpg_confchg_callback::member_list, res_lib_cpg_totem_confchg_callback::member_list, MESSAGE_RES_CPG_CONFCHG_CALLBACK, MESSAGE_RES_CPG_DELIVER_CALLBACK, MESSAGE_RES_CPG_PARTIAL_DELIVER_CALLBACK, MESSAGE_RES_CPG_TOTEM_CONFCHG_CALLBACK, cpg_model_data_t::model, cpg_inst::model_data, cpg_inst::model_v1_data, cpg_address::nodeid, cpg_assembly_data::nodeid, cpg_address::pid, cpg_assembly_data::pid, qb_to_cs_error(), and ring_id.

## cpg_fd_get()

cs_error_t cpg_fd_get | ( | cpg_handle_t | handle,
|  | int * | fd )

Get a file descriptor on which to poll.

cpg_handle_t is NOT a file descriptor and may not be used directly.

Parameters

  handle |
  fd |

Returns

Definition at line 294 of file lib/cpg.c.

References cpg_inst::c, CS_OK, hdb_error_to_cs(), and qb_to_cs_error().

## cpg_finalize()

cs_error_t cpg_finalize | ( | cpg_handle_t | handle | ) |

Close the cpg handle.

Parameters

  handle |

Returns

Definition at line 249 of file lib/cpg.c.

References cpg_inst::c, CS_ERR_BAD_HANDLE, CS_OK, cpg_inst::finalize, hdb_error_to_cs(), and MESSAGE_REQ_CPG_FINALIZE.

## cpg_flow_control_state_get()

cs_error_t cpg_flow_control_state_get | ( | cpg_handle_t | handle,
|  | cpg_flow_control_state_t * | flow_control_enabled )

cpg_flow_control_state_get

Parameters

  handle |
  flow_control_enabled |

Returns

Definition at line 847 of file lib/cpg.c.

References CPG_FLOW_CONTROL_DISABLED, CS_OK, and hdb_error_to_cs().

## cpg_initialize()

cs_error_t cpg_initialize | ( | cpg_handle_t * | handle,
|  | cpg_callbacks_t * | callbacks )

Create a new cpg connection.

Parameters

  handle |
  callbacks |

Returns

Definition at line 169 of file lib/cpg.c.

References cpg_callbacks_t::cpg_confchg_fn, cpg_model_v1_data_t::cpg_confchg_fn, cpg_callbacks_t::cpg_deliver_fn, cpg_model_v1_data_t::cpg_deliver_fn, cpg_model_initialize(), and CPG_MODEL_V1.

## cpg_iteration_finalize()

cs_error_t cpg_iteration_finalize | ( | cpg_iteration_handle_t | handle | ) |

cpg_iteration_finalize

Parameters

  handle |

Returns

Definition at line 1395 of file lib/cpg.c.

References CS_OK, hdb_error_to_cs(), and MESSAGE_REQ_CPG_ITERATIONFINALIZE.

## cpg_iteration_initialize()

cs_error_t cpg_iteration_initialize | ( | cpg_handle_t | handle,
|  | cpg_iteration_type_t | iteration_type,
|  | const struct cpg_name * | group,
|  | cpg_iteration_handle_t * | cpg_iteration_handle )

cpg_iteration_initialize

Parameters

  handle |
  iteration_type |
  group |
  cpg_iteration_handle |

Returns

Definition at line 1252 of file lib/cpg.c.

References cpg_inst::c, CPG_ITERATION_ALL, CPG_ITERATION_NAME_ONLY, CPG_ITERATION_ONE_GROUP, CPG_MAX_NAME_LENGTH, CS_ERR_INVALID_PARAM, CS_ERR_NAME_TOO_LONG, CS_OK, hdb_error_to_cs(), cpg_inst::iteration_list_head, cpg_name::length, cpg_iteration_instance::list, and MESSAGE_REQ_CPG_ITERATIONINITIALIZE.

## cpg_iteration_next()

cs_error_t cpg_iteration_next | ( | cpg_iteration_handle_t | handle,
|  | struct cpg_iteration_description_t * | description )

cpg_iteration_next

Parameters

  handle |
  description |

Returns

Definition at line 1345 of file lib/cpg.c.

References CS_ERR_INVALID_PARAM, CS_OK, hdb_error_to_cs(), MESSAGE_REQ_CPG_ITERATIONNEXT, and qb_to_cs_error().

## cpg_join()

cs_error_t cpg_join | ( | cpg_handle_t | handle,
|  | const struct cpg_name * | group )

Join one or more groups.

messages multicasted with cpg_mcast_joined will be sent to every group that has been joined on handle handle. Any message multicasted to a group that has been previously joined will be delivered in cpg_dispatch

Parameters

  handle |
  group |

Returns

Definition at line 647 of file lib/cpg.c.

References cpg_inst::c, CPG_MAX_NAME_LENGTH, CPG_MODEL_V1, CS_ERR_BUSY, CS_ERR_NAME_TOO_LONG, CS_OK, cpg_model_v1_data_t::flags, hdb_error_to_cs(), cpg_name::length, MESSAGE_REQ_CPG_JOIN, cpg_model_data_t::model, cpg_inst::model_data, and cpg_inst::model_v1_data.

## cpg_leave()

cs_error_t cpg_leave | ( | cpg_handle_t | handle,
|  | const struct cpg_name * | group )

Leave one or more groups.

Parameters

  handle |
  group |

Returns

Definition at line 701 of file lib/cpg.c.

References cpg_inst::c, CPG_MAX_NAME_LENGTH, CS_ERR_BUSY, CS_ERR_NAME_TOO_LONG, CS_OK, hdb_error_to_cs(), cpg_name::length, and MESSAGE_REQ_CPG_LEAVE.

## cpg_local_get()

cs_error_t cpg_local_get | ( | cpg_handle_t | handle,
|  | unsigned int * | local_nodeid )

cpg_local_get

Parameters

  handle |
  local_nodeid |

Returns

Definition at line 809 of file lib/cpg.c.

References cpg_inst::c, CS_OK, hdb_error_to_cs(), and MESSAGE_REQ_CPG_LOCAL_GET.

## cpg_max_atomic_msgsize_get()

cs_error_t cpg_max_atomic_msgsize_get | ( | cpg_handle_t | handle,
|  | uint32_t * | size )

Get maximum size of a message that will not be fragmented.

Parameters

  handle |
  size |

Returns

Definition at line 313 of file lib/cpg.c.

References CS_OK, hdb_error_to_cs(), and cpg_inst::max_msg_size.

## cpg_mcast_joined()

cs_error_t cpg_mcast_joined | ( | cpg_handle_t | handle,
|  | cpg_guarantee_t | guarantee,
|  | const struct iovec * | iovec,
|  | unsigned int | iov_len )

Multicast to groups joined with cpg_join.

Parameters

  handle |
  guarantee |
  iovec | This iovec will be multicasted to all groups joined with the cpg_join interface for handle.
  iov_len |

Definition at line 1204 of file lib/cpg.c.

References cpg_inst::c, CS_OK, guarantee, hdb_error_to_cs(), cpg_inst::max_msg_size, MESSAGE_REQ_CPG_MCAST, and qb_to_cs_error().

## cpg_membership_get()

cs_error_t cpg_membership_get | ( | cpg_handle_t | handle,
|  | struct cpg_name * | groupName,
|  | struct cpg_address * | member_list,
|  | int * | member_list_entries )

Get membership information from cpg.

Parameters

  handle |
  groupName |
  member_list |
  member_list_entries |

Returns

Definition at line 746 of file lib/cpg.c.

References cpg_inst::c, CPG_MAX_NAME_LENGTH, CS_ERR_INVALID_PARAM, CS_ERR_NAME_TOO_LONG, CS_OK, hdb_error_to_cs(), cpg_name::length, res_lib_cpg_membership_get::member_list, and MESSAGE_REQ_CPG_MEMBERSHIP.

## cpg_model_initialize()

cs_error_t cpg_model_initialize | ( | cpg_handle_t * | handle,
|  | cpg_model_t | model,
|  | cpg_model_data_t * | model_data,
|  | void * | context )

Create a new cpg connection, initialize with model.

Parameters

  handle |
  model |
  model_data |
  context |

Returns

Definition at line 185 of file lib/cpg.c.

References cpg_inst::assembly_list_head, cpg_inst::c, cpg_inst::context, CPG_MODEL_V1, CPG_MODEL_V1_DELIVER_INITIAL_TOTEM_CONF, CS_ERR_INVALID_PARAM, CS_OK, cpg_model_v1_data_t::flags, hdb_error_to_cs(), IPC_REQUEST_SIZE, cpg_inst::iteration_list_head, cpg_inst::max_msg_size, cpg_model_data_t::model, cpg_inst::model_data, cpg_inst::model_v1_data, and qb_to_cs_error().

Referenced by cpg_initialize().

## cpg_zcb_alloc()

cs_error_t cpg_zcb_alloc | ( | cpg_handle_t | handle,
|  | size_t | size,
|  | void ** | buffer )

cpg_zcb_alloc

Parameters

  handle |
  size |
  buffer |

Returns

Definition at line 947 of file lib/cpg.c.

References cpg_inst::c, CPG_ZC_PATH_LEN, CS_ERR_NAME_TOO_LONG, CS_OK, hdb_error_to_cs(), coroipcs_zc_header::map_size, and MESSAGE_REQ_CPG_ZC_ALLOC.

## cpg_zcb_free()

cs_error_t cpg_zcb_free | ( | cpg_handle_t | handle,
|  | void * | buffer )

cpg_zcb_free

Parameters

  handle |
  buffer |

Returns

Definition at line 1013 of file lib/cpg.c.

References cpg_inst::c, CS_OK, hdb_error_to_cs(), header, MESSAGE_REQ_CPG_ZC_FREE, and qb_to_cs_error().

## cpg_zcb_mcast_joined()

cs_error_t cpg_zcb_mcast_joined | ( | cpg_handle_t | handle,
|  | cpg_guarantee_t | guarantee,
|  | void * | msg,
|  | size_t | msg_len )

cpg_zcb_mcast_joined

Parameters

  handle |
  guarantee |
  msg |
  msg_len |

Returns

Definition at line 1062 of file lib/cpg.c.

References cpg_inst::c, CS_ERR_TOO_BIG, CS_OK, guarantee, hdb_error_to_cs(), IPC_REQUEST_SIZE, MESSAGE_REQ_CPG_MCAST, MESSAGE_REQ_CPG_ZC_EXECUTE, and coroipcs_zc_header::server_address.