Files @ a47f25c479d3
Branch filter:

Location: DistRen/src/server/listen.h

binki
fix warnings, fix initializations
/*
  Copyright 2009 Nathan Phillip Brink

  This file is a part of DistRen.

  DistRen is free software: you can redistribute it and/or modify
  it under the terms of the GNU Affero General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  DistRen is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU Affero General Public License for more details.

  You should have received a copy of the GNU Affero General Public License
  along with DistRen.  If not, see <http://www.gnu.org/licenses/>.
*/

struct distrend_clientset;
struct distrend_listen;
struct distrend_client;

#ifndef _DISTREN_LISTEN_H
#define _DISTREN_LISTEN_H

#include "distrend.h"

#include <list.h>

enum distrend_client_state
  {
    DISTREND_CLIENT_PREAUTH,
    DISTREND_CLIENT_GOODDOGGY,
    DISTREND_CLIENT_BADBOY
  };

struct distrend_listen
{
  int port;
  int sock;
};

struct distrend_client
{
  int sock;
  enum distrend_client_state state;
  LIST *inmsgs;
  LIST *outmsgs;
};



/**
   initializes the listens and clientset
   @param config the configuration from distrend
   @param clients a pointer to a struct distrend_clientset pointer which will be set to memory allocated for the clientset
 */
int distrend_listen(struct distrend_config *config, struct distrend_clientset **clients);

/**
   checks states of the sockets I'm managing. If there are any new connections,
   or activity on any sockets, I'll call the appropriate function.
   I will block until there is some sort of activity, including
   signals. If you want to cleanly shut down, it's best to register
   signal handlers somewhere
 */
int distrend_accept(struct distrend_config *config, struct distrend_clientset *clients);

/**
   cleans listening socket. Unnecessary for a working server, currently a stub.
 */
int distrend_unlisten(struct distrend_listen *listens, struct distrend_clientset *clients);

/**
   This is probably just NOT a placeholder for remotio
*/
void remotio_send_to_client();

#endif