Changeset - ba5d7bfefee2
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 16 years ago 2009-07-03 13:08:12
ohnobinki@ohnopublishing.net
sample main() function for distrend
1 file changed with 18 insertions and 15 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -70,29 +70,32 @@ int main(int argc, char *argv[])
 
So, we need a common key. Maybe. Or we need to generate a key in registeruser() and get it to the client somehow.
 
If we use a common key, then we'll need different passphrases for each user, which would be kinda crazy. How can
 
we get a key generated on the server, and transferred to the client's distrend?
 

	
 
*/
 

	
 

	
 
// We need the conf parser code from options.c here!!!
 
char *username = "unregistered"; // get this from conf
 

	
 

	
 
  int cont = 1;
 
  struct distrend_listenset *listenset;
 
  struct distrend_config *config;
 
  distrend_do_config(argc, argv, &config);
 

	
 
// Checks if the conf is left at the default username
 
int registered;
 
 error: People, this is not C++
 
if(username == "unregistered") {
 
  fprintf(stderr,"\nYou have not set your username in distrend.conf!\nIf you need to register a username, run distrend -c username email@example.com\n\n");
 
  registered = 0;
 
}
 
else{
 
  fprintf(stderr,"Logging into the DistRen server...\n");
 
}
 
  distrend_listen(&listenset, config);
 
  /* This is called the ``main loop'' */
 
  while(cont)
 
    {
 
      struct distren_action *action;
 
      
 
      distrend_accept(&action);
 
      cont = distrend_do(action);
 
      distrend_action_free(action);
 
    }
 
  
 
  distrend_unlisten(listenset);
 
  distrend_config_free(config);
 

	
 
  return 0;
 
}
 

	
 

	
 

	
 
// Registration on server. Needs attention. (e.g., people could make tons of accounts with the key we give them...
 
// Set up distrend -c username email@example.com
0 comments (0 inline, 0 general)