loadsa work
[carveJwlIkooP6JGAAIwe30JlM.git] / network.h
index 1644982917a49d4b5d08e7bf1abb72bfaf396f40..ee0f334d5cb04156dda91cac833cdcbd8cd04b9c 100644 (file)
--- a/network.h
+++ b/network.h
@@ -24,7 +24,6 @@ static void network_end(void);
  */
 static void network_submit_highscore( u32 trackid, u16 points, u16 time );
 
-
 /*
  * Game endpoints are provided with the same names to allow running without a
  * network connection.
@@ -112,6 +111,23 @@ static void server_connect(void)
                   hSteamNetworkingSockets, &remoteAddr, 0, NULL );
 }
 
+static void send_auth_ticket(void)
+{
+   u32 size = sizeof(netmsg_auth) + steam_app_ticket_length;
+   netmsg_auth *auth = malloc(size);
+
+   auth.inetmsg_id = k_inetmsg_auth;
+   auth.ticket_length = steam_app_ticket_length; 
+   for( int i=0; i<steam_app_ticket_length; i++ )
+      auth.ticket[i] = steam_app_ticket[i];
+
+   SteamAPI_ISteamNetworkingSockets_SendMessageToConnection(
+         hSteamNetworkingSockets, cremote, auth, size,
+         k_nSteamNetworkingSend_Reliable, NULL );
+   
+   free( auth );
+}
+
 static void scores_update(void)
 {
    vg_log( "scores_update()\n" );
@@ -119,7 +135,7 @@ static void scores_update(void)
    if( cremote_state == k_ESteamNetworkingConnectionState_Connected )
    {
       /*
-       * request updated scores
+       * request updated scores, this does not require any authentication.
        */
       netmsg_scores_request req;
       req.inetmsg_id = k_inetmsg_scores_request;
@@ -128,6 +144,13 @@ static void scores_update(void)
             hSteamNetworkingSockets, cremote, &req, 
             sizeof(netmsg_scores_request),
             k_nSteamNetworkingSend_Reliable, NULL );
+
+      /*
+       * Send record update, it requires authentication
+       */
+      if( steam_app_ticket_length )
+      {
+      }
    }
    else
    {