juegos

Juegos de terminal de Pancho: Catan (TUI, GUI, web, servidor, PicoCalc), ajedrez, calculadora y minijuegos
git clone https://git.lu3dhn.xyz/juegos.git
Log | Files | Refs

net.h (858B)


      1 /* net.h - cliente de red (servidor VPS o host LAN). Protocolo: comun/server/srv.h y server/server.h. */
      2 #ifndef NET_H
      3 #define NET_H
      4 
      5 #include "session.h"
      6 #include "netline.h"
      7 
      8 struct Server;
      9 
     10 Net *net_connect(const char *host, int port, const char *name, struct Server *embedded, char *err, int errlen);
     11 bool net_send(Net *n, const char *fmt, ...);
     12 bool net_read_line(Net *n, char *line, int len, int timeout_ms);  /* bloqueante (menus) */
     13 /* Espera GAME + historial hasta SYNC y deja la sesion lista. */
     14 bool net_enter_game(Net *n, Session *s, char *err, int errlen);
     15 const char *net_code(Net *n);
     16 const char *net_token(Net *n);
     17 int  net_seat(Net *n);
     18 
     19 void net_on_local_move(Net *n, const Move *m);
     20 int  net_submit(Net *n, Move *m);
     21 void net_poll(Net *n);
     22 int  net_fds(Net *n, int *fds, int max);
     23 int  net_timeout(Net *n);
     24 void net_close(Net *n);
     25 
     26 #endif