@@ -35,8 +35,7 @@ typedef struct Credentials_ {
3535 const char * username ;
3636} Credentials ;
3737
38- void on_auth_initial (CassAuthenticator * auth ,
39- void * data ) {
38+ void on_auth_initial (CassAuthenticator * auth , void * data ) {
4039 /*
4140 * This callback is used to initiate a request to begin an authentication
4241 * exchange. Required resources can be acquired and initialized here.
@@ -52,7 +51,7 @@ void on_auth_initial(CassAuthenticator* auth,
5251 * authentication callbacks were set and is available to all
5352 * authentication exchanges.
5453 */
55- const Credentials * credentials = (const Credentials * )data ;
54+ const Credentials * credentials = (const Credentials * )data ;
5655
5756 size_t username_size = strlen (credentials -> username );
5857 size_t password_size = strlen (credentials -> password );
@@ -68,20 +67,14 @@ void on_auth_initial(CassAuthenticator* auth,
6867 memcpy (response + username_size + 2 , credentials -> password , password_size );
6968}
7069
71- void on_auth_challenge (CassAuthenticator * auth ,
72- void * data ,
73- const char * token ,
74- size_t token_size ) {
70+ void on_auth_challenge (CassAuthenticator * auth , void * data , const char * token , size_t token_size ) {
7571 /*
7672 * Not used for plain text authentication, but this is to be used
7773 * for handling an authentication challenge initiated by the server.
7874 */
7975}
8076
81- void on_auth_success (CassAuthenticator * auth ,
82- void * data ,
83- const char * token ,
84- size_t token_size ) {
77+ void on_auth_success (CassAuthenticator * auth , void * data , const char * token , size_t token_size ) {
8578 /*
8679 * Not used for plain text authentication, but this is to be used
8780 * for handling the success phase of an exchange.
@@ -104,17 +97,10 @@ int main(int argc, char* argv[]) {
10497 char * hosts = "127.0.0.1,127.0.0.2,127.0.0.3" ;
10598
10699 /* Setup authentication callbacks and credentials */
107- CassAuthenticatorCallbacks auth_callbacks = {
108- on_auth_initial ,
109- on_auth_challenge ,
110- on_auth_success ,
111- on_auth_cleanup
112- };
113-
114- Credentials credentials = {
115- "cassandra" ,
116- "cassandra"
117- };
100+ CassAuthenticatorCallbacks auth_callbacks = { on_auth_initial , on_auth_challenge , on_auth_success ,
101+ on_auth_cleanup };
102+
103+ Credentials credentials = { "cassandra" , "cassandra" };
118104
119105 /* Add contact points */
120106 if (argc > 1 ) {
@@ -123,10 +109,7 @@ int main(int argc, char* argv[]) {
123109 cass_cluster_set_contact_points (cluster , hosts );
124110
125111 /* Set custom authentication callbacks and credentials */
126- cass_cluster_set_authenticator_callbacks (cluster ,
127- & auth_callbacks ,
128- NULL ,
129- & credentials );
112+ cass_cluster_set_authenticator_callbacks (cluster , & auth_callbacks , NULL , & credentials );
130113
131114 /* Provide the cluster object as configuration to connect the session */
132115 connect_future = cass_session_connect (session , cluster );
@@ -138,8 +121,7 @@ int main(int argc, char* argv[]) {
138121 const char * message ;
139122 size_t message_length ;
140123 cass_future_error_message (connect_future , & message , & message_length );
141- fprintf (stderr , "Unable to connect: '%.*s'\n" , (int )message_length ,
142- message );
124+ fprintf (stderr , "Unable to connect: '%.*s'\n" , (int )message_length , message );
143125 }
144126
145127 cass_future_free (connect_future );
0 commit comments