hub/member.c File Reference

#include "member.h"

Include dependency graph for member.c:

Go to the source code of this file.

Functions

 SGLIB_DEFINE_RBTREE_FUNCTIONS (Member, left, right, color, MEMBER_COMPARATOR)
MemberMember_find (Member *map, bstring pubkey)
MessageMember_first_msg (Member *member)
int Member_delete_msg (Member *member)
MemberMember_for_circuit (Member *member, long circuit)
int Member_send_msg (Member *member, Message *msg)
MemberMember_create (Peer *peer)
 Creates a new member not in the map yet.
MemberMember_login (Member **map, Peer *peer)
void Member_logout (Member **map, Member *member)
void Member_destroy (Member *mb)
void Member_destroy_map (Member **map)


Function Documentation

Member* Member_create ( Peer peer  ) 

Creates a new member not in the map yet.

Parameters:
peer : The peer structure for this member's connection.
Returns:
A constructed member.

Definition at line 78 of file member.c.

References assert_mem, assert_not, CRYPT_THEIR_KEY, CryptState_export_key(), Heap_create(), Member::key, MEMBER_MSG_QUEUE_LENGTH, MsgQueue_create(), Member::peer, Member::queue, Member::routes, and Peer::state.

Referenced by Member_login().

Here is the call graph for this function:

int Member_delete_msg ( Member member  ) 

Remove the message from the Member's queue front and return 0 if there are no more, 1 if there are.

Parameters:
member The member with the queue of interest.
Returns:
0 if no more, 1 if there are.

Definition at line 42 of file member.c.

References assert_not, MsgQueue_delete(), and Member::queue.

Referenced by ConnectionState_exec().

Here is the call graph for this function:

void Member_destroy ( Member mb  ) 

Called primarily by Member_logout or other error conditions, this removes cleans up the Member's stuff clearing out all the pending messages as well.

Parameters:
mb Member to destroy.

Definition at line 132 of file member.c.

References bdestroy(), Circuit_destroy_all(), Member::circuits, Heap_destroy(), Member::key, MsgQueue_destroy(), Member::queue, and Member::routes.

Referenced by Member_destroy_map(), Member_login(), and Member_logout().

Here is the call graph for this function:

void Member_destroy_map ( Member **  map  ) 

Destroys an entire Member map by going through each one and calling Member_destroy().

It sets the member map to NULL when it's done.

Parameters:
map IN/OUT The map to destroy.

Definition at line 141 of file member.c.

References assert_not, and Member_destroy().

Here is the call graph for this function:

Member* Member_find ( Member map,
bstring  pubkey 
)

Finds the Member in the map who has the given pubkey.

Parameters:
map Main member map to search in.
pubkey The key to search for.
Returns:
Member structure pointer or NULL if not found.

Definition at line 21 of file member.c.

References assert_not, and Member::key.

Message* Member_first_msg ( Member member  ) 

Get the reference to the next message for this Member. It will block the requesting task until there is a message ready to process. If this returns NULL then it means that the waiting task was woken up during a shutdown or delete, and should not use the member further.

Parameters:
member The member with the queue of interest.
Returns:
The first msg waiting or NULL if nothing.

Definition at line 35 of file member.c.

References assert_not, MsgQueue_first(), and Member::queue.

Referenced by ConnectionState_dequeue_msg().

Here is the call graph for this function:

Member* Member_for_circuit ( Member member,
long  circuit 
)

Given a circuit ID it finds the "to" member in this member's circuit list and returns it, otherwise it returns NULL.

Parameters:
member The member the circuit belongs to.
circuit The CID to search for.
Returns:
The other Member on this circuit, or NULL if not found.

Definition at line 49 of file member.c.

References Member::circuits, and Circuit::to.

Referenced by ConnectionState_exec().

Member* Member_login ( Member **  map,
Peer peer 
)

Add a member to the map based on their established Utu key, but don't let them login more than once.

Parameters:
map The member map to add this new member to.
peer The peer layer they are riding on.
Returns:
The Member structure created or NULL if failure.

Definition at line 94 of file member.c.

References check, Member_create(), Member_destroy(), and on_fail.

Referenced by ConnectionState_exec().

Here is the call graph for this function:

void Member_logout ( Member **  map,
Member member 
)

Removes the given member from the map, letting the GC clean them up when ready.

Parameters:
map The member map.
member The member to remove from the structure.

Definition at line 110 of file member.c.

References assert_not, Member_destroy(), MsgQueue_mark_dead, MsgQueue_wake_all, and Member::queue.

Referenced by ConnectionState_half_close().

Here is the call graph for this function:

int Member_send_msg ( Member member,
Message msg 
)

Send a message to the member, putting it on their queue.

Parameters:
member Who to send it to.
msg The message to send.
Returns:
1 for good, 0 for bad.

Definition at line 62 of file member.c.

References assert_not, check, MsgQueue_add(), MsgQueue_is_full, MsgQueue_wake_all, on_fail, and Member::queue.

Referenced by ConnectionState_exec(), Hub_broadcast(), and Route_deliver().

Here is the call graph for this function:

SGLIB_DEFINE_RBTREE_FUNCTIONS ( Member  ,
left  ,
right  ,
color  ,
MEMBER_COMPARATOR   
)


Generated on Tue Apr 10 01:01:30 2007 for Utu by  doxygen 1.5.1