Page 1 of 1

[Windows] K-Net Lib PB4+ Translation

Posted: Sun Dec 10, 2006 6:15 am
by kawasaki
For anyone who wants to use the K-Net Lib for PB4+, i took the liberty of adjusting the include file for it to work with the newer version of PB.
Although its been added to the main source of a project im working on now, i have yet to write anything that uses it, so as for its stability, you will have to find out for yourself.

Code: Select all

; +--------------------------------------+
; |    K-NetLib Wrapper for PureBasic    |
; |        (expects KNL v 3.0.2)         |
; +--------------------------------------+
; |     (C)2005 Krylar's Kreations       |
; | A Division of 1338 Enterprises, Inc. |
; |         All Rights Reserved          |
; +--------------------------------------+
; | Producer: John "Krylar" Logsdon      |
; | Coder...: Derlidio "PJoe" Siqueira   |
; +--------------------------------------+
; | Last Modified: 2005-06-20 (Y-M-D)    |
; +--------------------------------------+

;{/ Declares

;- Misc Functions (Declares)
Declare.l KNL_Initialize(GameID.s, Service.l, Session.l)
Declare.s KNL_GetVersion()
Declare   KNL_Shutdown()
Declare   KNL_StringOption(Flag.l)
Declare.s KNL_ParseString(UserStr.s, Item.l, Separator.s)
Declare   KNL_SetReceiveQueueLimit(Value.l)
;- Session Handling (Declares)
Declare.l KNL_SetSession(Setting.s, Value.s)
Declare.s KNL_GetSession(Setting.s)
Declare.s KNL_GetServerName()
Declare.s KNL_GetServerData()
Declare.l KNL_GetGameInfo()
Declare.l KNL_GetCaps()
Declare.l KNL_SetCaps(Field.s, Value.l)
Declare.l KNL_GetSPCaps(Provider.l)
Declare.l KNL_SetSPCaps(Provider.l, BufferSize.l)
;- Connection (Declares)
Declare.l KNL_CreateHost(PortNR.l, SessionName.s, Password.s, GameData.s, MaxPlayers.l)
Declare.l KNL_Connect(PlayerName.s, PlayerData.s, HostAddress.s, PortNR.l, Password.s, Method.l)
Declare.l KNL_CancelConnect()
Declare.l KNL_GetConnectionInfo(PlayerID.l)
Declare.l KNL_TerminateSession()
;- Game Timer (Declares)
Declare.l KNL_StartTimer()
Declare.l KNL_StopTimer()
Declare.l KNL_GetTimer()
;- Error Queue (Declares)
Declare   KNL_ErrorOption(Flag.l)
Declare   KNL_SetLogFile(File.s, Append.l)
Declare.l KNL_CheckErrors()
Declare.l KNL_GetErrorCode()
Declare.s KNL_GetErrorText()
Declare.s KNL_GetErrorMsg(ErrCode.l)
Declare.s KNL_GetErrorLocalTime()
Declare.l KNL_GetErrorGameTime()
Declare   KNL_CatchError(ErrCode.l, ErrMsg.s)
Declare   KNL_ClearError()
Declare   KNL_ClearErrors()
;- Message Inspection (Declares)
Declare.l KNL_UpdateNetwork(DestID.l, Priority.l, TimeOut.l, Flags.l)
Declare.l KNL_CancelMessage(Handle.l)
Declare.l KNL_CancelMessages(PlayerID.l, Priority.l)
Declare.l KNL_CheckMessages()
Declare.l KNL_GetMessageID()
Declare.l KNL_MessageFields()
Declare   KNL_ClearMessage()
Declare   KNL_ClearStream()
Declare.l KNL_SendQueueCount(Player.l)
Declare.l KNL_ReceiveQueueCount()
;- Send Commands (Single Values) (Declares)
Declare.l KNL_SetFieldName(Name.s)
Declare.l KNL_SendByte(Value.b)
Declare.l KNL_SendWord(Value.w)
Declare.l KNL_SendDWord(Value.l)
Declare.l KNL_SendFloat(Value.f)
Declare.l KNL_SendReal(Value.f) ; Alias
Declare.l KNL_SendInt(Value.w) ; Alias
Declare.l KNL_SendLong(Value.l) ; Alias
Declare.l KNL_SendInteger(Value.l) ; Alias
Declare.l KNL_SendString(Value.s)
Declare.l KNL_SendRawData(*Source.l, Size.l)
;- Send Commands (Arrays) (Declares)
Declare.l KNL_ArraySendByte(*Source.l, Elements.l)
Declare.l KNL_ArraySendWord(*Source.l, Elements.l)
Declare.l KNL_ArraySendDWord(*Source.l, Elements.l)
Declare.l KNL_ArraySendFloat(*Source.l, Elements.l)
Declare.l KNL_ArraySendReal(*Source.l, Elements.l) ; Alias
Declare.l KNL_ArraySendInt(*Source.l, Elements.l) ; Alias
Declare.l KNL_ArraySendLong(*Source.l, Elements.l) ; Alias
Declare.l KNL_ArraySendInteger(*Source.l, Elements.l) ; Alias
Declare.l KNL_ArraySendParsedString(Source.s, Separator.s)
;- Get Commands - by Index (Single Values) (Declares)
Declare.b KNL_GetByte(FldIdx.l)
Declare.w KNL_GetWord(FldIdx.l)
Declare.l KNL_GetDWord(FldIdx.l)
Declare.f KNL_GetFloat(FldIdx.l)
Declare.f KNL_GetReal(FldIdx.l) ; Alias
Declare.w KNL_GetInt(FldIdx.l) ; Alias
Declare.l KNL_GetLong(FldIdx.l) ; Alias
Declare.l KNL_GetInteger(FldIdx.l) ; Alias
Declare.s KNL_GetString(FldIdx.l)
Declare.l KNL_GetRawPtr(FldIdx.l)
;- Get Commands - by Index (Arrays) (Declares)
Declare.b KNL_ArrayGetByte(FldIdx.l, Element.l)
Declare.w KNL_ArrayGetWord(FldIdx.l, Element.l)
Declare.l KNL_ArrayGetDWord(FldIdx.l, Element.l)
Declare.f KNL_ArrayGetFloat(FldIdx.l, Element.l)
Declare.f KNL_ArrayGetReal(FldIdx.l, Element.l) ; Alias
Declare.w KNL_ArrayGetInt(FldIdx.l, Element.l) ; Alias
Declare.l KNL_ArrayGetLong(FldIdx.l, Element.l) ; Alias
Declare.l KNL_ArrayGetInteger(FldIdx.l, Element.l) ; Alias
Declare.s KNL_ArrayGetString(FldIdx.l, Element.l)
Declare   KNL_ArrayDump(FldIdx.l, *Address.l)
;- Field Inspection (Declares)
Declare.s KNL_FieldName(FldIdx.l)
Declare.l KNL_FieldType(FldIdx.l)
Declare.l KNL_FieldSize(FldIdx.l)
Declare.l KNL_FieldElements(FldIdx.l)
Declare.l KNL_FieldIndex(FldName.s)
;- Get Commands - by Name (Single Values) (Declares)
Declare.b KNL_FieldGetByte(FldName.s)
Declare.w KNL_FieldGetWord(FldName.s)
Declare.l KNL_FieldGetDWord(FldName.s)
Declare.f KNL_FieldGetFloat(FldName.s)
Declare.f KNL_FieldGetReal(FldName.s) ; Alias
Declare.w KNL_FieldGetInt(FldName.s) ; Alias
Declare.l KNL_FieldGetLong(FldName.s) ; Alias
Declare.l KNL_FieldGetInteger(FldName.s) ; Alias
Declare.s KNL_FieldGetString(FldName.s)
Declare.l KNL_FieldGetRawPtr(FldName.s)
;- Get Commands - By Name (Arrays) (Declares)
Declare.b KNL_FieldArrayGetByte(FldName.s, Element.l)
Declare.w KNL_FieldArrayGetWord(FldName.s, Element.l)
Declare.l KNL_FieldArrayGetDWord(FldName.s, Element.l)
Declare.f KNL_FieldArrayGetFloat(FldName.s, Element.l)
Declare.f KNL_FieldArrayGetReal(FldName.s, Element.l) ; Alias
Declare.w KNL_FieldArrayGetInt(FldName.s, Element.l) ; Alias
Declare.l KNL_FieldArrayGetLong(FldName.s, Element.l); Alias
Declare.l KNL_FieldArrayGetInteger(FldName.s, Element.l); Alias
Declare.s KNL_FieldArrayGetString(FldName.s, Element.l)
Declare   KNL_FieldArrayDump(FldName.s, *Address.l)
;- Splines (Declares)
Declare.l KNL_SplineCreate(Knots.l, Whole.f, Piece.f)
Declare   KNL_SplineDestroy(ID.l)
Declare   KNL_SplineSetKnot(ID.l, Knot.l, X.f, Y.f, Z.f)
Declare   KNL_SplineCalculate(ID.l)
Declare.f KNL_SplineGetX(ID.l, Frame.f)
Declare.f KNL_SplineGetY(ID.l, Frame.f)
Declare.f KNL_SplineGetZ(ID.l, Frame.f)
;- File Transfer (Declares)
Declare.l KNL_FileSend(PlayerID.l, FileID.l, FileName.s, Pack.l)
Declare.l KNL_FileAccept(Handle.l, Destination.s)
Declare.l KNL_FileRefuse(Handle.l)
Declare.f KNL_FileProgress(Handle.l)
Declare.l KNL_FileCancel(Handle.l)
;- Group Commands (Declares)
Declare.l KNL_GroupCreate(GroupName.s, GroupData.s, Method.l)
Declare.l KNL_GroupAddPlayer(PlayerID.l, GroupID.l, Method.l)
Declare.l KNL_GroupRemovePlayer(PlayerID.l, GroupID.l, Method.l)
Declare.l KNL_GroupDestroy(GroupID.l, Method.l)
;- Player Related Commands (Declares)
Declare.l KNL_SetPlayerInfo(PlayerName.s, PlayerData.s)
Declare.s KNL_GetPlayerName(PlayerID.l)
Declare.s KNL_GetPlayerData(PlayerID.l)
Declare.l KNL_DestroyPlayer(PlayerID.l)
;- Enumerations (Declares)
Declare.l KNL_EnumerateProviders()
Declare.s KNL_GetProviderName(Provider.l)
Declare.s KNL_GetProviderGUID(Provider.l)
Declare.l KNL_EnumerateDevices(Provider.l)
Declare.s KNL_GetDeviceName(Device.l)
Declare.s KNL_GetDeviceGUID(Device.l)
;- IP Commands (Declares)
Declare.s KNL_GetComputerName()
Declare.l KNL_CountLocalIPs()
Declare.s KNL_GetLocalIP(Index.l)
Declare.s KNL_GetPlayerIP(PlayerID.l)
Declare.s KNL_GetHostIP()
;- INI File Handling (Declares)
Declare.s KNL_ReadINI(File.s, Section.s, Parameter.s, DefaultValue.s)
Declare   KNL_WriteINI(File.s, Section.s, Parameter.s, Value.s)
;- Ban Control (Declares)
Declare KNL_SetBanFile(File.s)
Declare KNL_BanIP(IP.s, Duration.l)
Declare KNL_AllowIP(IP.s)
;}

;{- Constants Definition

; K-NetLib Session Initialization flags:

#KNL_INI_ClientServer = %0000000000000001 ; User is coding a Client/Server interface.
#KNL_INI_Peer2Peer    = %0000000000000010 ; User is coding a Peer to Peer interface.
#KNL_INI_Server       = %0000000000000100 ; User wants to host a game.
#KNL_INI_Client       = %0000000000001000 ; User will connect to a remote host.
#KNL_INI_MigrateHost  = %0000000000010000 ; (Peer only) Migrate host if host falls down.
#KNL_INI_Guaranteed   = %0000000000100000 ; Use guaranteed packets.
#KNL_INI_Sequential   = %0000000001000000 ; Deliver messages in the order they were sent.
#KNL_INI_LinkTunning  = %0000000010000000 ; Allows DX to perform network tunning.
#KNL_INI_CanQueryUser = %0000000100000000 ; Allows DX to query user for needed info.
#KNL_INI_SignPackets  = %0000001000000000 ; Sign all sent packets with an 8 byte key (DX Scheme).
#KNL_INI_UseSHA1      = %0000010000000000 ; Use a SHA1 (Secure Hash Algorithm v1.0) key to sign the packets.
#KNL_INI_LanSession   = %0000100000000000 ; Opens a larger send window for games running on a local area network (LAN). 

; K-NetLib Service Provider flags:

#KNL_Service_IPX        = %00000001
#KNL_Service_MODEM      = %00000010
#KNL_Service_SERIAL     = %00000100
#KNL_Service_TCPIP      = %00001000
#KNL_Service_BLUETOOTH  = %00010000

; K-NetLib Send flags:

#KNL_Send_NormalPriority = %00000000
#KNL_Send_LowPriority =    %00000001
#KNL_Send_HighPriority =   %00000010

#KNL_Send_Sync = 1
#KNL_Send_Guaranteed = 2
#KNL_Send_CompleteOnProcess = 4
#KNL_Send_Sequential = 8
#KNL_Send_NoComplete = 16
#KNL_Send_NoIndicate = 32

; K-NetLib Error Log flags:

#KNL_ErrNone = 0
#KNL_ErrQueue = 1
#KNL_ErrFile = 2
;}

;{- Enumerations

Enumeration ; Messge IDs
  
  #KNL_MSG_IndicateConnect = 1
  #KNL_MSG_ConnectAborted
  #KNL_MSG_ConnectComplete
  
  #KNL_MSG_CreatePlayer
  #KNL_MSG_DestroyPlayer
  
  #KNL_MSG_IndicateSend
  #KNL_MSG_Receive
  
  #KNL_MSG_AsyncOperationComplete
  #KNL_MSG_SendComplete
  
  #KNL_MSG_ServerInfo
  #KNL_MSG_PlayerInfo
  
  #KNL_MSG_CreateGroup
  #KNL_MSG_EnterGroup
  #KNL_MSG_LeaveGroup
  #KNL_MSG_DestroyGroup
  #KNL_MSG_GroupInfo
  
  #KNL_MSG_HostMigrate
  #KNL_MSG_TerminateSession
  
  #KNL_MSG_Handshake
  #KNL_MSG_ConnectionInfo
  #KNL_MSG_GameInfo
  
  #KNL_MSG_AcceptFile
  #KNL_MSG_FileAccepted
  #KNL_MSG_FileRefused
  #KNL_MSG_FileTransferComplete
  
  #KNL_MSG_TimerIgnited
  #KNL_MSG_TimerStopped
  
  #KNL_MSG_HostID
  
  #KNL_MSG_CAPS
  #KNL_MSG_SPCAPS
  
  #KNL_MSG_HostFound
  #KNL_MSG_Download
  #KNL_MSG_DownloadData
  
EndEnumeration

Enumeration ; Error IDs
   
   #KNL_SUCCESSFUL = -1 ; General success return value.
   #KNL_UNSUCCESSFUL =0 ; General failure return value.
   
   #KNL_ERR_MUSTIGNITE ; Must ignite K-NetLib first.
   #KNL_ERR_IGNITED ; Must shutdown before initializing again!
   #KNL_ERR_COM ; Could not initialize COM!
   
   #KNL_ERR_DXADDRESS ; Could not create required instance for DirectPlay8Address object.
   #KNL_ERR_ADDRESSCLEAR ; Problems on DirectPlay8Address shutdown!
   
   #KNL_ERR_SERVER ; Could not create a DirectPlay8Server object.
   #KNL_ERR_SERVERINI ; Could not initialize the DirectPlay8Server object.
   #KNL_ERR_SERVERSHUTDOWN ; Problems on DirectPlay8Server shutdown!
   
   #KNL_ERR_CLIENT ; Could not create a DirectPlay8Client object.
   #KNL_ERR_CLIENTINI ; Could not initialize the DirectPlay8Client object.
   #KNL_ERR_CLIENTSHUTDOWN ; Problems on DirectPlay8Client shutdown!
   
   #KNL_ERR_PEER ; Could not create a DirectPlay8Peer object.
   #KNL_ERR_PEERINI ; Could not initialize the DirectPlay8Peer object.
   #KNL_ERR_PEERSHUTDOWN ; Problems on DirectPlay8Peer shutdown!
   
   #KNL_ERR_COUNTPROVIDERS; Problems when trying to count service providers.
   #KNL_ERR_ENUMPROVIDERS; Problems when trying to retrieve service providers.
   #KNL_ERR_SETPROVIDER ; Could not set the desired service provider.
   
   #KNL_ERR_COUNTDEVICES ; Problems when trying to count providers' devices!
   #KNL_ERR_ENUMDEVICES ; Problems when trying to retrieve providers' devices!
   #KNL_ERR_MUSTENUMERATE ; Must enumerate providers first!
   
   #KNL_ERR_SESSIONCONFLICT ; Conflicting flags for Client/Server & Peer to Peer option.
   #KNL_ERR_SESSIONMISSING ; Session type was not passed: Client/Server or Peer to Peer.
   #KNL_ERR_GAMETYPECONFLICT ; Conflicting flags for Host/Client option.
   #KNL_ERR_GAMETYPEMISSING ; Game type was not defined: Host or Client.
   
   #KNL_ERR_INVALIDGUID ; GameID (GUID) is invalid!
   #KNL_ERR_SESSIONNAME ; A Game Name must be supplied!
   #KNL_ERR_PLAYERNAME ; A Player Name must be supplied!
   #KNL_ERR_GROUPNAME ; A Group Name must be supplied!
   #KNL_ERR_PORTNR ; Could not set the desired Port Number!
   
   #KNL_ERR_BUFFERSIZE ; Could not calculate required buffer size!
   #KNL_ERR_MEMALLOC ; Could not allocate required memory buffer!
   
   #KNL_ERR_SETPLAYERINFO ; Could not set player info!
   #KNL_ERR_GETPLAYERINFO ; Could not set player info!
   
   #KNL_ERR_SETGAMEINFO ; Could not set game info!
   #KNL_ERR_GETGAMEINFO ; Could not get geme info!
   
   #KNL_ERR_INVALIDPARM ; A parameter passed to a function is invalid!
   #KNL_ERR_SETTING; Invalid setting identifier!
   #KNL_ERR_OUTBOUND ; Out of bounds parameter was passed to a function call.
   #KNL_ERR_NOTALLOWED ; The selected operation is not allowed in the current session!
   
   #KNL_ERR_HOST ; Could not start the Host!
   #KNL_ERR_CONNECT ; Could not connect to the Host!
   #KNL_ERR_GROUP ; Could not create the Group!
   #KNL_ERR_ENTERGROUP; Could not add the player to the group!
   #KNL_ERR_LEAVEGROUP; Could not remove the player from the group!
   #KNL_ERR_DESTROYGROUP; Problems when trying to destroy the group!
   #KNL_ERR_DESTROYPLAYER ; Problems when trying to destroy the player!
   
   #KNL_ERR_PRCMSG ; Could not process received message!
   
   #KNL_ERR_TIMERIGNITED ; Game-Timer already ignited!
   #KNL_ERR_TIMERRESETED ; Game-Timer was reseted due to overflow.
   
   #KNL_ERR_HOSTREJECTEDCONNECTION ; The connection request was rejected by the host.
   #KNL_ERR_INVALIDAPPLICATION ; The globally unique identifier (guid) supplied for the application is invalid.
   #KNL_ERR_INVALIDDEVICEADDRESS ; The address for the local computer or adapter is invalid.
   #KNL_ERR_INVALIDFLAGS ; The Flags passed to this method are invalid.
   #KNL_ERR_INVALIDHOSTADDRESS ; The specified remote address is invalid.
   #KNL_ERR_INVALIDINSTANCE ; The guid for the application instance is invalid.
   #KNL_ERR_INVALIDINTERFACE ; The Interface parameter is invalid. This value will be returned in a connect request if the connecting player was not a client in a client/server game or a peer in a peer-to-peer game.
   #KNL_ERR_INVALIDPASSWORD ; An invalid password was supplied when attempting to join a private game session.
   #KNL_ERR_NOCONNECTION ; No communication link was established.
   #KNL_ERR_NOTHOST ; The client attempted to connect to a nonhost computer. Additionally, this error value may be returned by a nonhost that tried to set the application description.
   #KNL_ERR_SESSIONFULL ; The request to connect to the host or server failed because the maximum number of players allotted tor the session has been reached.
   #KNL_ERR_ALREADYCONNECTED ; The application is already connected to the session.
   #KNL_ERR_ALREADYINITIALIZED ; The application has already been initialized.
   #KNL_ERR_TERMINATESESSION ; Problems trying to terminate the session!
   
   #KNL_ERR_EMPTYSTREAM ; There is no data in the data stream!
   #KNL_ERR_CONNECTIONLOST ; The service provider connection was reset while data was being sent.
   #KNL_ERR_INVALIDPLAYER ; The player ID is not recognized as a valid player ID for this session.
   #KNL_ERR_INVALIDGROUP ; The group ID is not recognized as a valid group ID for this session.
   #KNL_ERR_TIMEOUT ; The operation could not complete because it has timed out.
   
   #KNL_ERR_PLAYERIP ; Could not retrieve the Player IP!
   #KNL_ERR_CONNECTIONINFO ; Could not retrieve the connection info!
   #KNL_ERR_GETSERVERINFO ; Could not retrieve server information!
   #KNL_ERR_DROPIP ; Could not drop the player IP.
   #KNL_ERR_CANCELMSG ; Could not cancel the message sending.
   #KNL_ERR_GAMEINFO ; Could not retrieve the game information.
   #KNL_ERR_FILEHANDLE ; The file transfer handle is invalid.
   #KNL_ERR_INVALIDFILE ; The supplied file name is invalid.
   #KNL_ERR_TIMERSYNC ; Could not sync all players!
   #KNL_ERR_BUFFERNAME ; The requested info was never set, or the required buffer could not be allocated."
   
   #KNL_ERR_THREAD ; Could not create a DirectPlay8ThreadPool object.
   #KNL_ERR_THREADINI ; Could not initialize the DirectPlay8ThreadPool object.
   #KNL_ERR_THREADSHUTDOWN ; Problems on DirectPlay8ThreadPool shutdown!
   
   #KNL_ERR_WINSOCK ; Could not initialize WinSock!
   
   #KNL_ERR_GETCAPS ; Could not get connection capabilities!
   #KNL_ERR_SETCAPS ; Could not set connection capabilities!
   
   #KNL_ERR_GETSPCAPS ; Could not get provider capabilities!
   #KNL_ERR_SETSPCAPS ; Could not set provider capabilities!
   
   #KNL_FH_UNEXPECTEDPOP ; Unexpected POP for File-Handle Stack.
   #KNL_FH_EMPTYSTACK ; Trying to POP from an empty File-Handle Stack.
   
   #KNL_INT_DBCREATE ; Could not create a DataBlock recipient!
   #KNL_INT_FLDCREATE ; Could not create a Field recipient!
   #KNL_INT_BSPLINECREATE ; Could not create a Spline recipient!
   #KNL_ERR_UNPREDICTED ; Unpredicted Error!
   
   #KNL_ERR_HOSTENUM ; Could not stop hosts enumeration!
   
   #KNL_ERR_HTTPSTART ; Could not start HTTP engine!
   #KNL_ERR_HTTPURL ; Could not access the given URL!
   
   #KNL_ERR_GETGROUPINFO ; Could not retrieve Group Information!
   #KNL_ERR_NOTREADY ; The object is not yet ready for use!
   #KNL_ERR_CANCELED ; Operation canceled by the application.
   
   #KNL_ERR_GROUPLIST ; Could not read the group members list!
   
EndEnumeration
;}

Global KNL.l

KNL = OpenLibrary(#PB_Any, "K-NetLib.dll")

If KNL = 0
   ; Whatever your program will do if library couldnt load.
EndIf

;- Misc Functions (Declares)
Procedure.l KNL_Initialize(GameID.s, Service.l, Session.l)
   ProcedureReturn CallFunction(KNL, "KNL_Initialize", GameID.s, Service.l, Session.l)
EndProcedure
Procedure.s KNL_GetVersion()
   
   ;*KNL_Str.l
   ;KNL_Tmp.s
   
   *KNL_Str = CallFunction(KNL, "KNL_GetVersion")
   KNL_Tmp.s = PeekS(*KNL_Str)
   FreeMemory(*KNL_Str)
   
   ProcedureReturn KNL_Tmp.s
   
EndProcedure
Procedure   KNL_Shutdown()
   CallFunction(KNL, "KNL_ShutDown")
EndProcedure
Procedure   KNL_StringOption(Flag.l)
   CallFunction(KNL, "KNL_StringOption", Flag.l)
EndProcedure
Procedure.s KNL_ParseString(UserStr.s, Item.l, Separator.s)
   
   ;*KNL_Str.l
   ;KNL_Tmp.s
   *KNL_Str.l
   KNL_Tmp.s
    CallFunction(KNL, "KNL_ParseString", Item.l, Separator.s)
   KNL_Tmp.s = PeekS(*KNL_Str)
   FreeMemory(*KNL_Str)
   
   ProcedureReturn KNL_Tmp.s
   
EndProcedure
Procedure   KNL_SetReceiveQueueLimit(Value.l)
   
   CallFunction(KNL, "KNL_SetReceiveQueueLimit", Value.l)
   
EndProcedure
;- Session Handling (Declares)
Procedure.l KNL_SetSession(Setting.s, Value.s)
   ProcedureReturn CallFunction(KNL, "KNL_SetSession", Setting.s, Value.s)
EndProcedure
Procedure.s KNL_GetSession(Setting.s)
   
   *KNL_Str.l
   KNL_Tmp.s
   
   *KNL_Str = CallFunction(KNL, "KNL_GetSession", Setting.s)
   KNL_Tmp.s = PeekS(*KNL_Str)
   FreeMemory(*KNL_Str)
   
   ProcedureReturn KNL_Tmp.s
   
EndProcedure
Procedure.s KNL_GetServerName()
   
   *KNL_Str.l
   KNL_Tmp.s
   
   *KNL_Str = CallFunction(KNL, "KNL_GetServerName")
   KNL_Tmp.s = PeekS(*KNL_Str)
   FreeMemory(*KNL_Str)
   
   ProcedureReturn KNL_Tmp.s
   
EndProcedure
Procedure.s KNL_GetServerData()
   
   *KNL_Str.l
   KNL_Tmp.s
   
   *KNL_Str = CallFunction(KNL, "KNL_GetServerData")
   KNL_Tmp.s = PeekS(*KNL_Str)
   FreeMemory(*KNL_Str)
   
   ProcedureReturn KNL_Tmp.s
   
EndProcedure
Procedure.l KNL_GetGameInfo()
EndProcedure
Procedure.l KNL_GetCaps()
   ProcedureReturn CallFunction(KNL, "KNL_GetCaps")
EndProcedure
Procedure.l KNL_SetCaps(Field.s, Value.l)
   ProcedureReturn CallFunction(KNL, "KNL_SetCaps", Field.s, Value.l)
EndProcedure
Procedure.l KNL_GetSPCaps(Provider.l)
   ProcedureReturn CallFunction(KNL, "KNL_GetSPCaps", Provider.l)
EndProcedure
Procedure.l KNL_SetSPCaps(Provider.l, BufferSize.l)
   ProcedureReturn CallFunction(KNL, "KNL_SetSPCaps", Provider.l, BufferSize.l)
EndProcedure

;- Connection (Declares)
Procedure.l KNL_CreateHost(PortNR.l, SessionName.s, Password.s, GameData.s, MaxPlayers.l)
   ProcedureReturn CallFunction(KNL, "KNL_CreateHost", PortNR.l, SessionName.s, Password.s, GameData.s, MaxPlayers.l)
EndProcedure
Procedure.l KNL_Connect(PlayerName.s, PlayerData.s, HostAddress.s, PortNR.l, Password.s, Method.l)
   ProcedureReturn CallFunction(KNL, "KNL_Connect", PlayerName.s, PlayerData.s, HostAddress.s, PortNR.l, Password.s, Method.l)
EndProcedure
Procedure.l KNL_CancelConnect()
   ProcedureReturn CallFunction(KNL, "KNL_CancelConnect")
EndProcedure
Procedure.l KNL_GetConnectionInfo(PlayerID.l)
   ProcedureReturn CallFunction(KNL, "KNL_GetConnectionInfo")
EndProcedure
Procedure.l KNL_TerminateSession()
   ProcedureReturn CallFunction(KNL,"KNL_TerminateSession")
EndProcedure

;- Game Timer (Declares)
Procedure.l KNL_StartTimer()
   ProcedureReturn CallFunction(KNL, "KNL_StartTimer")
EndProcedure
Procedure.l KNL_StopTimer()
   ProcedureReturn CallFunction(KNL, "KNL_StopTimer")
EndProcedure
Procedure.l KNL_GetTimer()
   ProcedureReturn CallFunction(KNL, "KNL_GetTimer")
EndProcedure

;- Error Queue (Declares)
Procedure   KNL_ErrorOption(Flag.l)
   CallFunction(KNL, "KNL_ErrorOption", Flag.l)
EndProcedure
Procedure   KNL_SetLogFile(File.s, Append.l)
   CallFunction(KNL, "KNL_SetLogFile", File.s, Append.l)
EndProcedure
Procedure.l KNL_CheckErrors()
   ProcedureReturn CallFunction(KNL, "KNL_CheckErrors")
EndProcedure
Procedure.l KNL_GetErrorCode()
   ProcedureReturn CallFunction(KNL, "KNL_GetErrorCode")
EndProcedure
Procedure.s KNL_GetErrorText()
   
   *KNL_Str.l
   KNL_Tmp.s
   
   *KNL_Str = CallFunction(KNL, "KNL_GetErrorText")
   KNL_Tmp.s = PeekS(*KNL_Str)
   FreeMemory(*KNL_Str)
   
   ProcedureReturn KNL_Tmp.s
   
EndProcedure
Procedure.s KNL_GetErrorMsg(ErrCode.l)
   
   *KNL_Str.l
   KNL_Tmp.s
   
   *KNL_Str = CallFunction(KNL, "KNL_GetErrorMsg", ErrCode.l)
   KNL_Tmp.s = PeekS(*KNL_Str)
   FreeMemory(*KNL_Str)
   
   ProcedureReturn KNL_Tmp.s
   
EndProcedure
Procedure.s KNL_GetErrorLocalTime()
   
   *KNL_Str.l
   KNL_Tmp.s
   
   *KNL_Str = CallFunction(KNL, "KNL_GetErrorLocalTime")
   KNL_Tmp.s = PeekS(*KNL_Str)
   FreeMemory(*KNL_Str)
   
   ProcedureReturn KNL_Tmp.s
   
EndProcedure
Procedure.l KNL_GetErrorGameTime()
   ProcedureReturn CallFunction(KNL, "KNL_GetErrorGameTime")
EndProcedure
Procedure   KNL_CatchError(ErrCode.l, ErrMsg.s)
   CallFunction(KNL,"KNL_CatchError", ErrCode.l, ErrMsg.s)
EndProcedure
Procedure   KNL_ClearError()
   CallFunction(KNL, "KNL_ClearError")
EndProcedure
Procedure   KNL_ClearErrors()
   CallFunction(KNL, "KNL_ClearErrors")
EndProcedure
Procedure.l KNL_ErrorQueueCount()
   ProcedureReturn CallFunction(KNL, "KNL_ErrorQueueCount")
EndProcedure

;- Message Inspection (Declares)
Procedure.l KNL_UpdateNetwork(DestID.l, Priority.l, TimeOut.l, Flags.l)
   ProcedureReturn CallFunction(KNL, "KNL_UpdateNetwork", DestID.l, Priority.l, TimeOut.l, Flags.l)
EndProcedure
Procedure.l KNL_CancelMessage(Handle.l)
   ProcedureReturn CallFunction(KNL, "KNL_CancelMessage", Handle.l)
EndProcedure
Procedure.l KNL_CancelMessages(PlayerID.l, Priority.l)
   ProcedureReturn CallFunction(KNL, "KNL_CancelMessages", PlayerID.l, Priority.l)
EndProcedure
Procedure.l KNL_CheckMessages()
   ProcedureReturn CallFunction(KNL, "KNL_CheckMessages")
EndProcedure
Procedure.l KNL_GetMessageID()
   ProcedureReturn CallFunction(KNL, "KNL_GetMessageID")
EndProcedure
Procedure.l KNL_MessageFields()
   ProcedureReturn CallFunction(KNL, "KNL_MessageFields")
EndProcedure
Procedure   KNL_ClearMessage()
   CallFunction(KNL, "KNL_ClearMessage")
EndProcedure
Procedure   KNL_ClearStream()
   CallFunction(KNL, "KNL_ClearStream")
EndProcedure
Procedure.l KNL_SendQueueCount(Player.l)
   ProcedureReturn CallFunction(KNL, "KNL_SendQueueCount", Player.l)
EndProcedure
Procedure.l KNL_ReceiveQueueCount()
   ProcedureReturn CallFunction(KNL, "KNL_ReceiveQueueCount")
EndProcedure
Procedure.l KNL_ForwardMessage()
   ProcedureReturn CallFunction(KNL, "KNL_ForwardMessage")
EndProcedure

;- Send Commands (Single Values) (Declares)
Procedure.l KNL_SetFieldName(Name.s)
   ProcedureReturn CallFunction(KNL, "KNL_SetFieldName", Name.s)
EndProcedure
Procedure.l KNL_SendByte(Value.b)
   ProcedureReturn CallFunction(KNL, "KNL_SendByte", Value.b)
EndProcedure
Procedure.l KNL_SendWord(Value.w)
   ProcedureReturn CallFunction(KNL, "KNL_SendWord", Value.w)
EndProcedure
Procedure.l KNL_SendDWord(Value.l)
   ProcedureReturn CallFunction(KNL, "KNL_SendDWord", Value.l)
EndProcedure
Procedure.l KNL_SendFloat(Value.f)
   ProcedureReturn CallFunction(KNL, "KNL_SendFloat", Value.f)
EndProcedure
Procedure.l KNL_SendReal(Value.f) ; Alias
   ProcedureReturn CallFunction(KNL, "KNL_SendReal", Value.f) ; Alias
EndProcedure
Procedure.l KNL_SendInt(Value.w) ; Alias
   ProcedureReturn CallFunction(KNL, "KNL_SendInt", Value.w)
EndProcedure
Procedure.l KNL_SendLong(Value.l) ; Alias
   ProcedureReturn CallFunction(KNL, "KNL_SendLong", Value.l)
EndProcedure
Procedure.l KNL_SendInteger(Value.l) ; Alias
   ProcedureReturn CallFunction(KNL, "KNL_SendInteger", Value.l)
EndProcedure
Procedure.l KNL_SendString(Value.s)
   ProcedureReturn CallFunction(KNL, "KNL_SendString", Value.s)
EndProcedure
Procedure.l KNL_SendRawData(*Source.l, Size.l)
   ProcedureReturn CallFunction(KNL, "KNL_SendRawData", *Source.l, Size.l)
EndProcedure

;- Send Commands (Arrays) (Declares)
Procedure.l KNL_ArraySendByte(*Source.l, Elements.l)
   ProcedureReturn CallFunction(KNL, "KNL_ArraySendByte", *Source.l, Elements.l)
EndProcedure
Procedure.l KNL_ArraySendWord(*Source.l, Elements.l)
   ProcedureReturn CallFunction(KNL, "KNL_ArraySendWord", *Source.l, Elements.l)
EndProcedure
Procedure.l KNL_ArraySendDWord(*Source.l, Elements.l)
   ProcedureReturn CallFunction(KNL, "KNL_ArraySendDWord", *Source.l, Elements.l)
EndProcedure
Procedure.l KNL_ArraySendFloat(*Source.l, Elements.l)
   ProcedureReturn CallFunction(KNL, "KNL_ArraySendFloat", *Source.l, Elements.l)
EndProcedure
Procedure.l KNL_ArraySendReal(*Source.l, Elements.l) ; Alias
   ProcedureReturn CallFunction(KNL, "KNL_ArraySendReal", *Source.l, Elements.l)
EndProcedure
Procedure.l KNL_ArraySendInt(*Source.l, Elements.l) ; Alias
   ProcedureReturn CallFunction(KNL, "KNL_arraySendInt", *Source.l, Elements.l)
EndProcedure
Procedure.l KNL_ArraySendLong(*Source.l, Elements.l) ; Alias
   ProcedureReturn CallFunction(KNL, "KNL_ArraySendLong", *Source.l, Elements.l)
EndProcedure
Procedure.l KNL_ArraySendInteger(*Source.l, Elements.l) ; Alias
   ProcedureReturn CallFunction(KNL, "KNL_ArraySendInteger", *Source.l, Elements.l)
EndProcedure
Procedure.l KNL_ArraySendParsedString(Source.s, Separator.s)
   ProcedureReturn CallFunction(KNL, "KNL_ArraySendParsedString", Source.s, Separator.s)
EndProcedure

;- Get Commands - by Index (Single Values) (Declares)
Procedure.b KNL_GetByte(FldIdx.l)
   ProcedureReturn CallFunction(KNL, "KNL_GetByte", FldIdx.l)
EndProcedure
Procedure.w KNL_GetWord(FldIdx.l)
   ProcedureReturn CallFunction(KNL, "KNL_GetWord", FldIdx.l)
EndProcedure
Procedure.l KNL_GetDWord(FldIdx.l)
   ProcedureReturn CallFunction(KNL, "KNL_GetDWord", FldIdx.l)
EndProcedure
Procedure.f KNL_GetFloat(FldIdx.l)
   ProcedureReturn CallFunction(KNL, "KNL_GetFloat", FldIdx.l)
EndProcedure
Procedure.f KNL_GetReal(FldIdx.l) ; Alias
   ProcedureReturn CallFunction(KNL, "KNL_GetReal", FldIdx.l)
EndProcedure
Procedure.w KNL_GetInt(FldIdx.l) ; Alias
   ProcedureReturn CallFunction(KNL, "KNL_GetInt", FldIdx.l)
EndProcedure
Procedure.l KNL_GetLong(FldIdx.l) ; Alias
   ProcedureReturn CallFunction(KNL, "KNL_GetLong", FldIdx.l)
EndProcedure
Procedure.l KNL_GetInteger(FldIdx.l) ; Alias
   ProcedureReturn CallFunction(KNL, "KNL_GetInteger", FldIdx.l)
EndProcedure
Procedure.s KNL_GetString(FldIdx.l)
   
   *KNL_Str.l
   KNL_Tmp.s
   
   *KNL_Str = CallFunction(KNL, "KNL_GetString", FldIdx.l)
   KNL_Tmp.s = PeekS(*KNL_Str)
   FreeMemory(*KNL_Str)
   
   ProcedureReturn KNL_Tmp.s
   
EndProcedure
Procedure.l KNL_GetRawPtr(FldIdx.l)
   ProcedureReturn CallFunction(KNL, "KNL_GetRawPtr", FldIdx.l)
EndProcedure
;- Get Commands - by Index (Arrays) (Declares)
Procedure.b KNL_ArrayGetByte(FldIdx.l, Element.l)
   ProcedureReturn CallFunction(KNL, "KNL_ArrayGetByte", FldIdx.l, Element.l)
EndProcedure
Procedure.w KNL_ArrayGetWord(FldIdx.l, Element.l)
   ProcedureReturn CallFunction(KNL, "KNL_ArrayGetWord", FldIdx.l, Element.l)
EndProcedure
Procedure.l KNL_ArrayGetDWord(FldIdx.l, Element.l)
   ProcedureReturn CallFunction(KNL, "KNL_ArrayGetDWord", FldIdx.l, Element.l)
EndProcedure
Procedure.f KNL_ArrayGetFloat(FldIdx.l, Element.l)
   ProcedureReturn CallFunction(KNL, "KNL_ArrayGetFloat", FldIdx.l, Element.l)
EndProcedure
Procedure.f KNL_ArrayGetReal(FldIdx.l, Element.l) ; Alias
   ProcedureReturn CallFunction(KNL, "KNL_ArrayGetReal", FldIdx.l, Element.l)
EndProcedure
Procedure.w KNL_ArrayGetInt(FldIdx.l, Element.l) ; Alias
   ProcedureReturn CallFunction(KNL, "KNL_ArrayGetInt", FldIdx.l, Element.l)
EndProcedure
Procedure.l KNL_ArrayGetLong(FldIdx.l, Element.l) ; Alias
   ProcedureReturn CallFunction(KNL, "KNL_ArrayGetLong", FldIdx.l, Element.l)
EndProcedure
Procedure.l KNL_ArrayGetInteger(FldIdx.l, Element.l) ; Alias
   ProcedureReturn CallFunction(KNL, "KNL_ArrayGetInteger", FldIdx.l, Element.l)
EndProcedure
Procedure.s KNL_ArrayGetString(FldIdx.l, Element.l)
   
   *KNL_Str.l
   KNL_Tmp.s
   
   *KNL_Str = CallFunction(KNL, "KNL_GetString", FldIdx.l, Element.l)
   KNL_Tmp.s = PeekS(*KNL_Str)
   FreeMemory(*KNL_Str)
   
   ProcedureReturn KNL_Tmp.s
   
EndProcedure
Procedure   KNL_ArrayDump(FldIdx.l, *Address.l)
   CallFunction(KNL, "KNL_ArrayDump", FldIdx.l, *Address.l)
EndProcedure

;- Field Inspection (Declares)
Procedure.s KNL_FieldName(FldIdx.l)
   
   *KNL_Str.l
   KNL_Tmp.s
   
   *KNL_Str = CallFunction(KNL, "KNL_FieldName", FldIdx.l)
   KNL_Tmp.s = PeekS(*KNL_Str)
   FreeMemory(*KNL_Str)
   
   ProcedureReturn KNL_Tmp.s
   
EndProcedure
Procedure.l KNL_FieldType(FldIdx.l)
   ProcedureReturn CallFunction(KNL, "KNL_FieldType", FldIdx.l)
EndProcedure
Procedure.l KNL_FieldSize(FldIdx.l)
   ProcedureReturn CallFunction(KNL, "KNL_FieldSize", FldIdx.l)
EndProcedure
Procedure.l KNL_FieldElements(FldIdx.l)
   ProcedureReturn CallFunction(KNL, "KNL_FieldElements", FldIdx.l)
EndProcedure
Procedure.l KNL_FieldIndex(FldName.s)
   ProcedureReturn CallFunction(KNL, "KNL_FieldIndex", FldName.s)
EndProcedure

;- Get Commands - by Name (Single Values) (Declares)
Procedure.b KNL_FieldGetByte(FldName.s)
   ProcedureReturn CallFunction(KNL,"KNL_FieldGetByte", FldName.s)
EndProcedure
Procedure.w KNL_FieldGetWord(FldName.s)
   ProcedureReturn CallFunction(KNL,"KNL_FieldGetWord", FldName.s)
EndProcedure
Procedure.l KNL_FieldGetDWord(FldName.s)
   ProcedureReturn CallFunction(KNL,"KNL_FieldGetDWord", FldName.s)
EndProcedure
Procedure.f KNL_FieldGetFloat(FldName.s)
   ProcedureReturn CallFunction(KNL,"KNL_FieldGetFloat", FldName.s)
EndProcedure
Procedure.f KNL_FieldGetReal(FldName.s) ; Alias
   ProcedureReturn CallFunction(KNL,"KNL_FieldGetReal", FldName.s)
EndProcedure
Procedure.w KNL_FieldGetInt(FldName.s) ; Alias
   ProcedureReturn CallFunction(KNL,"KNL_FildGetInt", FldName.s)
EndProcedure
Procedure.l KNL_FieldGetLong(FldName.s) ; Alias
   ProcedureReturn CallFunction(KNL,"KNL_FieldGetLong", FldName.s)
EndProcedure
Procedure.l KNL_FieldGetInteger(FldName.s) ; Alias
   ProcedureReturn CallFunction(KNL,"KNL_FieldGetInteger", FldName.s)
EndProcedure
Procedure.s KNL_FieldGetString(FldName.s)
   
   *KNL_Str.l
   KNL_Tmp.s
   
   *KNL_Str = CallFunction(KNL, "KNL_FieldGetString", FldName.s)
   KNL_Tmp.s = PeekS(*KNL_Str)
   FreeMemory(*KNL_Str)
   
   ProcedureReturn KNL_Tmp.s
   
EndProcedure
Procedure.l KNL_FieldGetRawPtr(FldName.s)
   ProcedureReturn CallFunction(KNL,"KNL_FieldGetRawPtr", FldName.s)
EndProcedure

;- Get Commands - By Name (Arrays) (Declares)
Procedure.b KNL_FieldArrayGetByte(FldName.s, Element.l)
   ProcedureReturn CallFunction(KNL, "KNL_FieldArrayGetByte", FldName.s, Element.l)
EndProcedure
Procedure.w KNL_FieldArrayGetWord(FldName.s, Element.l)
   ProcedureReturn CallFunction(KNL, "KNL_FieldArrayGetWord", FldName.s, Element.l)
EndProcedure
Procedure.l KNL_FieldArrayGetDWord(FldName.s, Element.l)
   ProcedureReturn CallFunction(KNL, "KNL_FieldArrayGetDWord", FldName.s, Element.l)
EndProcedure
Procedure.f KNL_FieldArrayGetFloat(FldName.s, Element.l)
   ProcedureReturn CallFunction(KNL, "KNL_FieldArrayGetFloat", FldName.s, Element.l)
EndProcedure
Procedure.f KNL_FieldArrayGetReal(FldName.s, Element.l) ; Alias
   ProcedureReturn CallFunction(KNL, "KNL_FieldArrayGetReal", FldName.s, Element.l) ; Alias
EndProcedure
Procedure.w KNL_FieldArrayGetInt(FldName.s, Element.l) ; Alias
   ProcedureReturn CallFunction(KNL,"KNL_FieldArrayGetInt", FldName.s, Element.l)
EndProcedure
Procedure.l KNL_FieldArrayGetLong(FldName.s, Element.l); Alias
   ProcedureReturn CallFunction(KNL,"KNL_FieldArrayGetLong", FldName.s, Element.l)
EndProcedure
Procedure.l KNL_FieldArrayGetInteger(FldName.s, Element.l); Alias
   ProcedureReturn CallFunction(KNL,"KNL_FieldArrayGetInteger", FldName.s, Element.l)
EndProcedure
Procedure.s KNL_FieldArrayGetString(FldName.s, Element.l)
   
   *KNL_Str.l
   KNL_Tmp.s
   
   *KNL_Str = CallFunction(KNL, "KNL_FieldArrayGetString", FldName.s, Element.l)
   KNL_Tmp.s = PeekS(*KNL_Str)
   FreeMemory(*KNL_Str)
   
   ProcedureReturn KNL_Tmp.s
   
EndProcedure
Procedure   KNL_FieldArrayDump(FldName.s, *Address.l)
   ProcedureReturn CallFunction(KNL,"KNL_FieldArrayDump", FldName.s, *Address.l)
EndProcedure

;- Splines (Declares)
Procedure.l KNL_SplineCreate(Knots.l, Whole.f, Piece.f)
   ProcedureReturn CallFunction(KNL, "KNL_SplineCreate", Knots.l, Whole.f, Piece.f)
EndProcedure
Procedure   KNL_SplineDestroy(ID.l)
   CallFunction(KNL, "KNL_SplineDestroy", ID.l)
EndProcedure
Procedure   KNL_SplineSetKnot(ID.l, Knot.l, X.f, Y.f, Z.f)
   CallFunction(KNL, "KNL_SplineSetKnot", ID.l, Knot.l, X.f, Y.f, Z.f)
EndProcedure
Procedure   KNL_SplineCalculate(ID.l)
   CallFunction(KNL,"KNL_SplineCalculate", ID.l)
EndProcedure
Procedure.f KNL_SplineGetX(ID.l, Frame.f)
   ProcedureReturn CallFunction(KNL,"KNL_SplineGetX", ID.l, Frame.f)
EndProcedure
Procedure.f KNL_SplineGetY(ID.l, Frame.f)
   ProcedureReturn CallFunction(KNL,"KNL_SplineGetY", ID.l, Frame.f)
EndProcedure
Procedure.f KNL_SplineGetZ(ID.l, Frame.f)
   ProcedureReturn CallFunction(KNL,"KNL_SplineGetZ", ID.l, Frame.f)
EndProcedure

;- File Transfer (Declares)
Procedure.l KNL_FileSend(PlayerID.l, FileID.l, FileName.s, Pack.l)
   ProcedureReturn CallFunction(KNL, "KNL_FileSend", PlayerID.l, FileID.l, FileName.s, Pack.l)
EndProcedure
Procedure.l KNL_FileAccept(Handle.l, Destination.s)
   ProcedureReturn CallFunction(KNL, "KNL_FileAccept", Handle.l, Destination.s)
EndProcedure
Procedure.l KNL_FileRefuse(Handle.l)
   ProcedureReturn CallFunction(KNL, "KNL_FileRefuse", Handle.l)
EndProcedure
Procedure.f KNL_FileProgress(Handle.l)
   ProcedureReturn CallFunction(KNL, "KNL_FileProgress", Handle.l)
EndProcedure
Procedure.l KNL_FileCancel(Handle.l)
   ProcedureReturn CallFunction(KNL, "KNL_FileCancel", Handle.l)
EndProcedure

;- Group Commands (Declares)
Procedure.l KNL_GroupCreate(GroupName.s, GroupData.s, Method.l)
   ProcedureReturn CallFunction(KNL, "KNL_GroupCreate", GroupName.s, GroupData.s, Method.l)
EndProcedure
Procedure.l KNL_GroupAddPlayer(PlayerID.l, GroupID.l, Method.l)
   ProcedureReturn CallFunction(KNL, "KNL_GroupAddPlayer", PlayerID.l, GroupID.l, Method.l)
EndProcedure
Procedure.l KNL_GroupRemovePlayer(PlayerID.l, GroupID.l, Method.l)
   ProcedureReturn CallFunction(KNL, "KNL_GroupRemovePlayer", PlayerID.l, GroupID.l, Method.l)
EndProcedure
Procedure.l KNL_GroupDestroy(GroupID.l, Method.l)
   ProcedureReturn CallFunction(KNL, "KNL_GroupDestroy", GroupID.l, Method.l)
EndProcedure
Procedure.s KNL_GroupGetName(GroupID.l)
   
   *KNL_Str.l
   KNL_Tmp.s
   
   *KNL_Str = CallFunction(KNL, "KNL_GroupGetName", GroupID.l)
   KNL_Tmp.s = PeekS(*KNL_Str)
   FreeMemory(*KNL_Str)
   
   ProcedureReturn KNL_Tmp.s
   
EndProcedure
Procedure.s KNL_GroupGetData(GroupID.l)
   
   *KNL_Str.l
   KNL_Tmp.s
   
   *KNL_Str = CallFunction(KNL, "KNL_GroupGetData", GroupID.l)
   KNL_Tmp.s = PeekS(*KNL_Str)
   FreeMemory(*KNL_Str)
   
   ProcedureReturn KNL_Tmp.s
   
EndProcedure
Procedure.l KNL_GroupGetContext(GroupID.l)
   ProcedureReturn CallFunction(KNL, "KNL_GroupGetContext", GroupID.l)
EndProcedure

Procedure.l KNL_GroupGetList(GroupID.l)
   ProcedureReturn CallFunction(KNL,"KNL_GroupGetList",GroupID.l)
EndProcedure
Procedure   KNL_GroupFreeList(Handle.l)
   CallFunction(KNL,"KNL_GroupFreeList",Handle.l)
EndProcedure
Procedure.l KNL_GroupListCount(Handle.l)
   ProcedureReturn CallFunction(KNL,"KNL_GroupListCount",Handle.l)
EndProcedure
Procedure.l KNL_GroupListGetID(Handle.l, Index.l)
   ProcedureReturn CallFunction(KNL,"KNL_GroupListGetID",Handle.l,Index.l)
EndProcedure
Procedure.s KNL_GroupListGetName(Handle.l, Index.l)
   
   *KNL_Str.l
   KNL_Tmp.s
   
   *KNL_Str = CallFunction(KNL, "KNL_GroupListGetName",Handle.l,Index.l)
   KNL_Tmp.s = PeekS(*KNL_Str)
   FreeMemory(*KNL_Str)
   
   ProcedureReturn KNL_Tmp.s
   
EndProcedure
Procedure.s KNL_GroupListGetData(Handle.l, Index.l)
   
   *KNL_Str.l
   KNL_Tmp.s
   
   *KNL_Str = CallFunction(KNL, "KNL_GroupListGetData",Handle.l,Index.l)
   KNL_Tmp.s = PeekS(*KNL_Str)
   FreeMemory(*KNL_Str)
   
   ProcedureReturn KNL_Tmp.s
   
EndProcedure

;- Player Related Commands (Declares)
Procedure.l KNL_SetPlayerInfo(PlayerName.s, PlayerData.s)
   ProcedureReturn CallFunction(KNL, "KNL_SetPlayerInfo", PlayerName.s, PlayerData.s)
EndProcedure
Procedure.s KNL_GetPlayerName(PlayerID.l)
   
   *KNL_Str.l
   KNL_Tmp.s
   
   *KNL_Str = CallFunction(KNL, "KNL_GetPlayerName", PlayerID.l)
   KNL_Tmp.s = PeekS(*KNL_Str)
   FreeMemory(*KNL_Str)
   
   ProcedureReturn KNL_Tmp.s
   
EndProcedure
Procedure.s KNL_GetPlayerData(PlayerID.l)
   
   *KNL_Str.l
   KNL_Tmp.s
   
   *KNL_Str = CallFunction(KNL, "KNL_GetPlayerData", PlayerID.l)
   KNL_Tmp.s = PeekS(*KNL_Str)
   FreeMemory(*KNL_Str)
   
   ProcedureReturn KNL_Tmp.s
   
EndProcedure
Procedure.l KNL_DestroyPlayer(PlayerID.l)
   ProcedureReturn CallFunction(KNL, "KNL_DestroyPlayer", PlayerID.l)
EndProcedure

;- Enumerations (Declares)
Procedure.l KNL_EnumerateProviders()
   ProcedureReturn CallFunction(KNL, "KNL_EnumerateProviders")
EndProcedure
Procedure.s KNL_GetProviderName(Provider.l)
   
   *KNL_Str.l
   KNL_Tmp.s
   
   *KNL_Str = CallFunction(KNL, "KNL_GetProviderName", Provider.l)
   KNL_Tmp.s = PeekS(*KNL_Str)
   FreeMemory(*KNL_Str)
   
   ProcedureReturn KNL_Tmp.s
   
EndProcedure
Procedure.s KNL_GetProviderGUID(Provider.l)
   
   *KNL_Str.l
   KNL_Tmp.s
   
   *KNL_Str = CallFunction(KNL, "KNL_GetProviderGUID", Provider.l)
   KNL_Tmp.s = PeekS(*KNL_Str)
   FreeMemory(*KNL_Str)
   
   ProcedureReturn KNL_Tmp.s
   
EndProcedure

Procedure.l KNL_EnumerateDevices(Provider.l)
   ProcedureReturn CallFunction(KNL, "KNL_EnumerateDevices", Provider.l)
EndProcedure
Procedure.s KNL_GetDeviceName(Device.l)
   
   *KNL_Str.l
   KNL_Tmp.s
   
   *KNL_Str = CallFunction(KNL, "KNL_GetDeviceName", Device.l)
   KNL_Tmp.s = PeekS(*KNL_Str)
   FreeMemory(*KNL_Str)
   
   ProcedureReturn KNL_Tmp.s
   
EndProcedure
Procedure.s KNL_GetDeviceGUID(Device.l)
   
   *KNL_Str.l
   KNL_Tmp.s
   
   *KNL_Str = CallFunction(KNL, "KNL_GetDeviceGuid", Device.l)
   KNL_Tmp.s = PeekS(*KNL_Str)
   FreeMemory(*KNL_Str)
   
   ProcedureReturn KNL_Tmp.s
   
EndProcedure

Procedure.l KNL_EnumerateHosts(PortNR.l)
   ProcedureReturn CallFunction(KNL, "KNL_EnumerateHosts", PortNR.l)
EndProcedure
Procedure.l KNL_StopHostsEnumeration()
   ProcedureReturn CallFunction(KNL, "KNL_StopHostsEnumeration")
EndProcedure
Procedure.l KNL_QueryHost(IP.s, PortNR.l)
   ProcedureReturn CallFunction(KNL, "KNL_QueryHost", IP.s, PortNR.l)
EndProcedure

;- IP Commands (Declares)
Procedure.s KNL_GetComputerName()
   
   *KNL_Str.l
   KNL_Tmp.s
   
   *KNL_Str = CallFunction(KNL, "KNL_GetComputerName")
   KNL_Tmp.s = PeekS(*KNL_Str)
   FreeMemory(*KNL_Str)
   
   ProcedureReturn KNL_Tmp.s
   
EndProcedure
Procedure.l KNL_CountLocalIPs()

EndProcedure
Procedure.s KNL_GetLocalIP(Index.l)
   
   *KNL_Str.l
   KNL_Tmp.s
   
   *KNL_Str = CallFunction(KNL, "KNL_GetLocalIP", Index.l)
   KNL_Tmp.s = PeekS(*KNL_Str)
   FreeMemory(*KNL_Str)
   
   ProcedureReturn KNL_Tmp.s
   
EndProcedure
Procedure.s KNL_GetPlayerIP(PlayerID.l)
   
   *KNL_Str.l
   KNL_Tmp.s
   
   *KNL_Str = CallFunction(KNL, "KNL_GetPlayerIP", PlayerID.l)
   KNL_Tmp.s = PeekS(*KNL_Str)
   FreeMemory(*KNL_Str)
   
   ProcedureReturn KNL_Tmp.s
   
EndProcedure
Procedure.s KNL_GetHostIP()
   
   *KNL_Str.l
   KNL_Tmp.s
   
   *KNL_Str = CallFunction(KNL, "KNL_GetHostIP")
   KNL_Tmp.s = PeekS(*KNL_Str)
   FreeMemory(*KNL_Str)
   
   ProcedureReturn KNL_Tmp.s
   
EndProcedure

;- INI File Handling (Declares)
Procedure.s KNL_ReadINI(File.s, Section.s, Parameter.s, DefaultValue.s)
   
   *KNL_Str.l
   KNL_Tmp.s
   
   *KNL_Str = CallFunction(KNL, "KNL_ReadINI", File.s, Section.s, Parameter.s, DefaultValue.s)
   KNL_Tmp.s = PeekS(*KNL_Str)
   FreeMemory(*KNL_Str)
   
   ProcedureReturn KNL_Tmp.s
   
EndProcedure
Procedure KNL_WriteINI(File.s, Section.s, Parameter.s, Value.s)
   CallFunction(KNL, "KNL_WriteINI", File.s, Section.s, Parameter.s, Value.s)
EndProcedure

;- Ban Control (Declares)
Procedure KNL_SetBanFile(File.s)
   CallFunction(KNL, "KNL_SetBanFile", File.s)
EndProcedure
Procedure KNL_BanIP(IP.s, Duration.l)
   CallFunction(KNL, "KNL_BanIP", IP.s, Duration.l)
EndProcedure
Procedure KNL_AllowIP(IP.s)
  CallFunction(KNL, "KNL_AllowIP", IP.s)
EndProcedure

;- HTTP and FTP Download
Procedure.l KNL_Download(Client.s, URL.s, LocalFile.s, ID.l)
   ProcedureReturn CallFunction(KNL, "KNL_Download", Client.s, URL.s, LocalFile.s, ID.l)
EndProcedure

Procedure.l KNL_DownloadGetHandle(Client.s, URL.s, LocalFile.s, ID.l)
   ProcedureReturn CallFunction(KNL,"KNL_DownloadGetHandle",Client.s, URL.s, LocalFile.s, ID.l)
EndProcedure
Procedure   KNL_DownloadFreeHandle(Handle.l)
   CallFunction(KNL,"KNL_DownloadFreeHandle",Handle.l)
EndProcedure
Procedure.l KNL_DownloadSize(Handle.l)
   ProcedureReturn CallFunction(KNL,"KNL_DownloadSize",Handle.l)
EndProcedure
Procedure.l KNL_DownloadBytes(Handle.l)
   ProcedureReturn CallFunction(KNL,"KNL_DownloadBytes",Handle.l)
EndProcedure
Procedure.f KNL_DownloadProgress(Handle.l)
   ProcedureReturn CallFunction(KNL,"KNL_DownloadProgress",Handle.l)
EndProcedure
Procedure   KNL_DownloadCancel(Handle.l)
   CallFunction(KNL,"KNL_DownloadCancel",Handle.l)
EndProcedure
;}

Re: [Windows] K-Net Lib PB4+ Translation

Posted: Wed Dec 13, 2006 3:58 am
by NoahPhense
kewl.. thx

- np

Posted: Tue Jun 05, 2007 6:24 pm
by sigmason
Has anyone experienced issues with this code?

I'm asking because I'm concerned because the README file in the source code file says that it's not stable in Windows XP with large traffic loads.

Is this code still in development?

Sigmason

Posted: Tue Jun 05, 2007 8:50 pm
by Godai
KNL_GetReal(FldIdx.l)

Hehe. Get real damnit :)

Posted: Tue Jun 05, 2007 10:14 pm
by sigmason
Godai wrote:KNL_GetReal(FldIdx.l)

Hehe. Get real damnit :)
Okay, LOL, clue me in on this.

Are you joking about my question, about the library or what?

Sigmason

Posted: Wed Jun 06, 2007 1:33 pm
by Leonhard
Why do you not use 'Import'?

So where the Code faster.