Reputation: 820
Im trying to understand the data flow of ejabberd and having a hard time till now.
First, these are the modules Im working on: ejabberd_c2s, ejabberd_auth, ejabberd_sm, ejabberd_sm_mnesia.
I understand that ejabberd_c2s is a gen_fsm that is entry point for any client that wants to talk to any other client.
Dataflow: When a client connects to ejabberd_c2s, it sends some data, not sure exactly what but along the lines of {JID}. But not able to figure out how ejabberd_c2s authenticates? Where does it actually call the authentication module and if the authentication is successful, who creates a session for that user? is it ejabberd_c2s or ejabberd_auth ?
I understand that ejabberd_sm[_mnesia] are the api calls that will actually create a session for anyone.
References to code/ samples is highly appreciated.!
How exactly this whole thing works?
Thanks a lot!
Upvotes: 1
Views: 248
Reputation: 9055
Authentication is primarily made is wait_for_stream
function of c2s: https://github.com/processone/ejabberd/blob/master/src/ejabberd_c2s.erl#L348
Session is created in wait_for_bind
function of c2s:
https://github.com/processone/ejabberd/blob/master/src/ejabberd_c2s.erl#L1046
Upvotes: 1