⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 libnet.txt

📁 Libnet is a cross-platform library aimed at game developers. It has an abstract high level API, whic
💻 TXT
📖 第 1 页 / 共 4 页
字号:
of the incoming and outgoing queues respectively.Return value............   Zero on success.     int in_queue, out_queue;     net_conn_stats (conn, &in_queue, &out_queue);2.3.15 net_getpeer------------------Prototype.........     char *net_getpeer (NET_CONN *conn);Purpose.......   This function gives the address of the peer of this conn,i.e. the computer at the other end.  The conn must be in theconnected state (a return value from `net_poll_listen' orpassed to a successful `net_poll_connect').Parameters..........   CONN is the conn whose address will be returned.Return value............   A pointer to a static array is returned.  Do not writethrough the pointer.  `NULL' is returned on error.     printf ("Connection received from %s\n", net_getpeer (conn));2.4 Driver List Functions=========================   These functions are provided to manipulate driver lists.2.4.1 net_driverlist_create---------------------------Prototype.........     NET_DRIVERLIST net_driverlist_create (void);Purpose.......   This function creates a new driver list.  Initially thedriver list will be cleared.Return value............   This function returns a pointer to the `NET_DRIVERLIST'struct it creates, or `NULL' on error (extremely unlikely).2.4.2 net_driverlist_destroy----------------------------Prototype.........     void net_driverlist_destroy (NET_DRIVERLIST list);Purpose.......   Frees the memory occupied by a driver list.Parameters..........   LIST is the driver list to free.2.4.3 net_driverlist_clear--------------------------Prototype.........     int net_driverlist_clear (NET_DRIVERLIST list);Purpose.......   This function clears a driver list.Parameters..........   LIST is the driver list to clear.Return value............   This function always returns 1.2.4.4 net_driverlist_add------------------------Prototype.........     int net_driverlist_add (NET_DRIVERLIST list, int driver);Purpose.......   This function adds a driver to a driver list.Parameters..........   DRIVER is one of the `NET_DRIVER_*' constants, and will beadded to the driver list LIST.Return value............   This function always returns 1.2.4.5 net_driverlist_remove---------------------------Prototype.........     int net_driverlist_remove (NET_DRIVERLIST list, int driver);Purpose.......   This function removes a driver from a driver list.Parameters..........   LIST is the driver list from which the driver DRIVER will beremoved.Return value............   This function always returns 1.2.4.6 net_driverlist_add_list-----------------------------Prototype.........     int net_driverlist_add_list (NET_DRIVERLIST list1, NET_DRIVERLIST list2);Purpose.......   This function adds the contents of one driver list toanother driver list.Parameters..........   The contents of driver list LIST2 will be added into thecontents of driver list LIST1.  LIST1 will be modified in place.Return value............   This function always returns 1.2.4.7 net_driverlist_remove_list--------------------------------Prototype.........     int net_driverlist_remove_list (NET_DRIVERLIST list1, NET_DRIVERLIST list2);Purpose.......   This function removes the contents of one driver list fromanother driver list.Parameters..........   The contents of driver list LIST2 will be removed fromdriver list LIST1.  LIST1 will be modified in place.Return value............   This function always returns 1.2.4.8 net_driverlist_test-------------------------Prototype.........     int net_driverlist_test (NET_DRIVERLIST list, int driver);Purpose.......   This function tests if a specific driver is contained in adriver list.Parameters..........   LIST is the driver list in which to look for the driverDRIVER.Return value............   Returns non-zero if LIST contains DRIVER, otherwise returnszero.2.4.9 net_driverlist_foreach----------------------------Prototype.........     int net_driverlist_foreach (NET_DRIVERLIST list,     	int (*func)(int driver, void *dat), void *dat);Purpose.......   This function iterates through a driver list, calling acallback function for each driver in the list.Parameters..........   LIST is the driver list to iterate through.   FUNC is the callback function that will be called for eachdriver in LIST.  It will be passed two arguments: the driver andDAT.  It should return an integer.  If the integer is non-zero,`net_driverlist_foreach' will stop iterating through the list.   DAT is a parameter which you can use to pass any data youwant to the callback function.Return value............   Returns zero if iteration was terminated by the callbackfunction, otherwise returns non-zero.Notes.....   Note that Libnet driver lists do not preserve the order inwhich you add or remove drivers.  Currently,`net_driverlist_foreach' iterates from the driver with thesmallest id number to the largest.  However, this, and theassignment of id numbers, may change in future, so you shouldnot rely on any particular ordering.2.4.10 net_driverlist_count---------------------------Prototype.........     int net_driverlist_count (NET_DRIVERLIST list);Purpose.......   Counts the number of drivers in a driver list.Parameters..........   LIST is the driver list to count.Return value............   The number of drivers in LIST.2.5 Alphabetic List of Functions================================   This is an alphabetic list of all the interface functions ofLibnet.net_assigntarget:          See ``2.2.3 net_assigntarget''.net_closechannel:          See ``2.2.2 net_closechannel''.net_closeconn:          See ``2.3.2 net_closeconn''.net_conn_stats:          See ``2.3.14 net_conn_stats''.net_connect:          See ``2.3.5 net_connect''.net_connect_wait_cb:          See ``2.3.8 net_connect_wait_cb''.net_connect_wait_cb_time:          See ``2.3.9 net_connect_wait_cb_time''.net_connect_wait_time:          See ``2.3.7 net_connect_wait_time''.net_detectdrivers:          See ``2.1.5 net_detectdrivers''.net_driverlist_add:          See ``2.4.4 net_driverlist_add''.net_driverlist_add_list:          See ``2.4.6 net_driverlist_add_list''.net_driverlist_clear:          See ``2.4.3 net_driverlist_clear''.net_driverlist_count:          See ``2.4.10 net_driverlist_count''.net_driverlist_create:          See ``2.4.1 net_driverlist_create''.net_driverlist_destroy:          See ``2.4.2 net_driverlist_destroy''.net_driverlist_foreach:          See ``2.4.9 net_driverlist_foreach''.net_driverlist_remove:          See ``2.4.5 net_driverlist_remove''.net_driverlist_remove_list:          See ``2.4.7 net_driverlist_remove_list''.net_driverlist_test:          See ``2.4.8 net_driverlist_test''.net_getdrivernames:          See ``2.1.4 net_getdrivernames''.net_getlocaladdress:          See ``2.2.4 net_getlocaladdress''.net_getpeer:          See ``2.3.15 net_getpeer''.net_ignore_rdm:          See ``2.3.13 net_ignore_rdm''.net_init:          See ``2.1.1 net_init''.net_initdrivers:          See ``2.1.6 net_initdrivers''.net_listen:          See ``2.3.3 net_listen''.net_loadconfig:          See ``2.1.3 net_loadconfig''.net_openchannel:          See ``2.2.1 net_openchannel''.net_openconn:          See ``2.3.1 net_openconn''.net_poll_connect:          See ``2.3.6 net_poll_connect''.net_poll_listen:          See ``2.3.4 net_poll_listen''.net_query:          See ``2.2.7 net_query''.net_query_rdm:          See ``2.3.12 net_query_rdm''.net_receive:          See ``2.2.6 net_receive''.net_receive_rdm:          See ``2.3.11 net_receive_rdm''.net_register_driver:          See ``2.1.2 net_register_driver''.net_send:          See ``2.2.5 net_send''.net_send_rdm:          See ``2.3.10 net_send_rdm''.net_shutdown:          See ``2.1.7 net_shutdown''.3. Notes on Drivers in Libnet*****************************   The drivers fall into the following categories:3.1 No networking=================Network type     No networkingEnvironment     AnyCode     `NET_DRIVER_NONET'Description     This driver will return success codes for everything, but     won't actually do anything.  It's a dummy driver, in case     no others are available.  Target and return addresses are     meaningless; send an empty string to `net_assigntarget'.Principal author     George Foot3.2 Template driver===================Network type     No networkingEnvironment     AnyCode     n/aDescription     This driver is very similar to the `nonet' driver.  It     exists to show implementors how to write new drivers.  See     the source code (`lib/drivers/template.c'), which is well     commented.  If anything is not clear, please contact me so     that I can correct the problem.Principal author     George Foot3.3 Berkeley sockets====================Network type     InternetEnvironment     UnixCode     `NET_DRIVER_SOCKETS'Description     This driver uses Berkeley sockets on Unix machines to     access the Internet.     It has been tested at various times on Linux (i386), OSF1     (DEC Alpha) and FreeBSD.Principal author     George Foot3.4 Winsock from Windows========================Network type     InternetEnvironment     Windows (native)Code     `NET_DRIVER_WSOCKWIN'Description     This driver uses the Winsock from Windows to access the     Internet.     It has been tested with RSXNTDJ+DJGPP and MSVC++.Principal author     George Foot3.5 Winsock from a DOS box==========================Network type     InternetEnvironment     DOS (under Windows)Code     `NET_DRIVER_WSOCK_DOS'Description     This driver uses the Winsock from DOS to access the     Internet.  It only works with version 1.x of Winsock -- in     particular it does not work with Winsock 2, as distributed     with Windows 98.  Obviously this only works from a DOS     prompt under Windows.     It has been tested with DJGPP but this was some time ago     (i.e.  before the author used Windows 98).Principal author     George Foot3.6 IPX from DOS================Network type     IPXEnvironment     DOSCode     `NET_DRIVER_IPX_DOS'Description     This driver uses BIOS level routines to access an IPX     network.     It has been tested on DOS and a DOS box under Windows     95/98.Principal author     Ralph Deane3.7 Serial link from DOS========================Network type     SerialEnvironment     DOSCode     `NET_DRIVER_SERIAL_DOS'Description     This driver sends its data over serial ports.Principal author     Peter Wang3.8 Local host==============Network type     Local host (no real network)Environment     AllCode     `NET_DRIVER_LOCAL'Description     This driver provides a local network for the passing of     data from one part of a program to another. It is mostly     used in a server/client program to provide a network link     to the local client.     It will work on all platforms.Principal author     Ralph Deane3.9 Other drivers=================   DOS-based Internet drivers via PPP and through network cardswere once being worked on by Ove Kaaven.  Currently the onlyway to play over the Internet from plain DOS using Libnet is torun Kali, which emulates IPX over an Internet connection.  Youstill need to have Internet software for DOS.  Libnet's IPXdriver should be able to use this emulated IPX, but it hasn'tbeen tested yet.  If you try it, please let me (gfoot) know how

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -