1 #ifndef OPTIONS_H 2 #define OPTIONS_H 3 /*=========================================================================*\ 4 * Common option interface 5 * LuaSocket toolkit 6 * 7 * This module provides a common interface to socket options, used mainly by 8 * modules UDP and TCP. 9 * 10 * RCS ID: $Id: options.h,v 1.4 2005/10/07 04:40:59 diego Exp $ 11 \*=========================================================================*/ 12 13 #include "lua.h" 14 #include "socket.h" 15 16 /* option registry */ 17 typedef struct t_opt { 18 const char *name; 19 int (*func)(lua_State *L, p_socket ps); 20 } t_opt; 21 typedef t_opt *p_opt; 22 23 /* supported options */ 24 int opt_dontroute(lua_State *L, p_socket ps); 25 int opt_broadcast(lua_State *L, p_socket ps); 26 int opt_reuseaddr(lua_State *L, p_socket ps); 27 int opt_tcp_nodelay(lua_State *L, p_socket ps); 28 int opt_keepalive(lua_State *L, p_socket ps); 29 int opt_linger(lua_State *L, p_socket ps); 30 int opt_reuseaddr(lua_State *L, p_socket ps); 31 int opt_ip_multicast_ttl(lua_State *L, p_socket ps); 32 int opt_ip_multicast_loop(lua_State *L, p_socket ps); 33 int opt_ip_add_membership(lua_State *L, p_socket ps); 34 int opt_ip_drop_membersip(lua_State *L, p_socket ps); 35 36 /* invokes the appropriate option handler */ 37 int opt_meth_setoption(lua_State *L, p_opt opt, p_socket ps); 38 39 #endif 40