dist_nifs.c
Include dependency graph for dist_nifs.c:
Implementation of distribution NIFs and resources.
Enums
-
enum [anonymous]
Values:
-
enumerator OPERATION_LINK = 1
-
enumerator OPERATION_NODE_LINK = 5
-
enumerator OPERATION_REG_SEND = 6
-
enumerator OPERATION_GROUP_LEADER = 7
-
enumerator OPERATION_REG_SEND_TT = 16
-
enumerator OPERATION_MONITOR_P = 19
-
enumerator OPERATION_DEMONITOR_P = 20
-
enumerator OPERATION_SEND_SENDER = 22
-
enumerator OPERATION_SEND_SENDER_TT = 23
-
enumerator OPERATION_PAYLOAD_EXIT = 24
-
enumerator OPERATION_PAYLOAD_EXIT_TT = 25
-
enumerator OPERATION_PAYLOAD_EXIT2 = 26
-
enumerator OPERATION_PAYLOAD_EXIT2_TT = 27
-
enumerator OPERATION_PAYLOAD_MONITOR_P_EXIT = 28
-
enumerator OPERATION_SPAWN_REQUEST = 29
-
enumerator OPERATION_SPAWN_REQUEST_TT = 30
-
enumerator OPERATION_SPAWN_REPLY = 31
-
enumerator OPERATION_SPAWN_REPLY_TT = 32
-
enumerator OPERATION_UNLINK_ID = 35
-
enumerator OPERATION_UNLINK_ID_ACK = 36
-
enumerator OPERATION_ALIAS_SEND = 33
-
enumerator OPERATION_ALIAS_SEND_TT = 34
-
enumerator OPERATION_LINK = 1
Functions
-
static void dist_connection_dtor(ErlNifEnv *caller_env, void *obj)
-
static void dist_enqueue_message(term control_message, term payload, struct DistConnection *connection, GlobalContext *global)
-
static void dist_enqueue_reg_send_message(int32_t local_process_id, term remote_process_name, term payload, struct DistConnection *connection, GlobalContext *global)
-
static void dist_enqueue_send_sender_message(int32_t local_process_id, term remote_process_id, term payload, struct DistConnection *connection, GlobalContext *global)
-
static void dist_enqueue_monitor_exit_message(struct RemoteMonitor *monitor, term reason, struct DistConnection *connection, GlobalContext *global)
-
static void dist_connection_down(ErlNifEnv *caller_env, void *obj, ErlNifPid *pid, ErlNifMonitor *mon)
-
term dist_monitor(struct DistConnection *conn_obj, term from_pid, term target_proc, term monitor_ref, Context *ctx)
@doc Setup a monitor on a local process for a distributed process. @end
- Parameters:
conn_obj – object of the connection
from_pid – remote pid setting up the monitor
target_proc – atom (for registered process) or pid of the local process to monitor
monitor_ref – reference used for monitor
ctx – context for memory allocation
-
term dist_send_message(term target, term payload, Context *ctx)
@doc Enqueue a message to be sent to a remote process. This function may raise a badarg error following OTP if target is incorrect.
- Parameters:
target – external pid or a tuple {atom(), node()} to refer to a remote registered process
payload – message to send
ctx – process that sends the message.
- Returns:
the payload if the message was sent or term_invalid if there was a badarg error
-
void dist_spawn_reply(term req_id, term to_pid, bool link, bool monitor, term result, struct DistConnection *connection, GlobalContext *global)
@doc Send a spawn reply signal to a node @end
- Parameters:
conn_obj – object of the connection
req_id – reference identifying the request
to_pid – (remote) process id identifying the caller
link – if a link was created
monitor – if a monitor was created
result – pid of the spawned process or atom for an error
ctx – context for memory allocation
Variables
-
const ErlNifResourceTypeInit dist_connection_resource_type_init = {.members = 3, .dtor = dist_connection_dtor, .stop = NULL, .down = dist_connection_down,}
-
const struct Nif setnode_3_nif = {.base.type = NIFFunctionType, .nif_ptr = nif_erlang_setnode_3}
-
const struct Nif dist_ctrl_get_data_notification_nif = {.base.type = NIFFunctionType, .nif_ptr = nif_erlang_dist_ctrl_get_data_notification}
-
const struct Nif dist_ctrl_get_data_nif = {.base.type = NIFFunctionType, .nif_ptr = nif_erlang_dist_ctrl_get_data}
-
const struct Nif dist_ctrl_put_data_nif = {.base.type = NIFFunctionType, .nif_ptr = nif_erlang_dist_ctrl_put_data}
-
struct DistributionPacket
Collaboration diagram for DistributionPacket:
-
struct RemoteMonitor
Collaboration diagram for RemoteMonitor:
-
struct DistConnection
Collaboration diagram for DistConnection: