mirror of https://github.com/deavmi/libtun.git
Updated documentation for methods already implemented
This commit is contained in:
parent
bd21d7f7a3
commit
a234f52908
|
@ -26,6 +26,15 @@ public class TUNAdapter
|
||||||
private byte[] scratch;
|
private byte[] scratch;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new Adapter with the given interface name
|
||||||
|
* and optionally you can specifiy the adapter type (default
|
||||||
|
* is TAP)
|
||||||
|
*
|
||||||
|
* Params:
|
||||||
|
* interfaceName = the name of the interface to create
|
||||||
|
* adapterType = The AdapterType to use
|
||||||
|
*/
|
||||||
this(string interfaceName, AdapterType adapterType = AdapterType.TAP)
|
this(string interfaceName, AdapterType adapterType = AdapterType.TAP)
|
||||||
{
|
{
|
||||||
init(interfaceName, adapterType);
|
init(interfaceName, adapterType);
|
||||||
|
@ -57,6 +66,12 @@ public class TUNAdapter
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes the adapter
|
||||||
|
*
|
||||||
|
* Throws:
|
||||||
|
* TUNException if the operation failed
|
||||||
|
*/
|
||||||
public void close()
|
public void close()
|
||||||
{
|
{
|
||||||
sanityCheck();
|
sanityCheck();
|
||||||
|
@ -65,7 +80,15 @@ public class TUNAdapter
|
||||||
destroyTun(tunFD);
|
destroyTun(tunFD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blocks to receive into the buffer
|
||||||
|
*
|
||||||
|
* Params:
|
||||||
|
* buffer = The buffer variable to write the received
|
||||||
|
* data into
|
||||||
|
* Throws:
|
||||||
|
* TUNException if the read failed
|
||||||
|
*/
|
||||||
public void receive(ref byte[] buffer)
|
public void receive(ref byte[] buffer)
|
||||||
{
|
{
|
||||||
sanityCheck();
|
sanityCheck();
|
||||||
|
@ -97,17 +120,16 @@ public class TUNAdapter
|
||||||
/* Copy the data into their buffer (and of correct length) */
|
/* Copy the data into their buffer (and of correct length) */
|
||||||
buffer = scratch[0..status].dup;
|
buffer = scratch[0..status].dup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends the provided data
|
||||||
|
*
|
||||||
|
* Params:
|
||||||
|
* buffer = The data to send
|
||||||
|
* Throws:
|
||||||
|
* TUNException if an error occurs
|
||||||
|
*/
|
||||||
public void send(byte[] buffer)
|
public void send(byte[] buffer)
|
||||||
{
|
{
|
||||||
sanityCheck();
|
sanityCheck();
|
||||||
|
|
Loading…
Reference in New Issue