Ok, so I have made some small progress in implementing networking.
However, I have a few things I don't quite understand since I have never
really dug so deep into networking before:
1. I am trying to implement a TcpListener[1]. I think TcpListener can be
implemented by setting the `EFI_TCP6_ACCESS_POINT->ActiveFlag` to false
during configuration. However, while binding the TcpListenere to an
address, should the `StationAddress` or the `RemoteAddress` be set to
the supplied address?
2. Is there any UEFI Shell Application/utility that I can use to listen
to an address (like `nc` in linux). This would be helpful for me to test
out whether something is a problem in my implementation or in my qemu
config.
3. The networking stuff in Rust is synchronous. Currently, I am creating
a new event during accept with the following parameters:
```
Type = EVT_NOTIFY_SIGNAL
NotifyTpl = TPL_CALLBACK
NotifyFunction = <Empty function that does nothing>
NotifyContext = NULL
```
I pass this event as `ListenToken->CompletionToken->Event`. Then I call
`EFI_BOOT_SERVICES.WaitForEvent()` on this event. Is there any better
way to do this?
4. Does the EFI_TCP6_PROTOCOL support IPv4-mapped IPv6 address [2]? I
was thinking just converting the IPv4 address to IPv6 instead of using
EFI_TCP4_PROTOCOL.
Ayush Singh
[1]: https://doc.rust-lang.org/std/net/struct.TcpListener.html#
[2]:
https://doc.rust-lang.org/std/net/struct.Ipv6Addr.html#ipv4-mapped-ipv6-addresses
On 7/14/22 00:00, Ayush Singh wrote:
Thanks. I'm not sure if I will use it directly, but it gives a very
good idea about using these protocols in Rust std.
On Wed, Jul 13, 2022 at 11:07 PM Kinney, Michael D
<michael.d.kin...@intel.com> wrote:
It may be simpler to use the following lib class that layers on top of the TCP
protocols.
https://github.com/tianocore/edk2/blob/master/NetworkPkg/Include/Library/TcpIoLib.h
The implementation of this lib shows the correct sequence:
https://github.com/tianocore/edk2/blob/master/NetworkPkg/Library/DxeTcpIoLib/DxeTcpIoLib.c
It uses NetLib services too
https://github.com/tianocore/edk2/blob/master/NetworkPkg/Library/DxeNetLib/DxeNetLib.c
Mike
-----Original Message-----
From: Ayush Singh <ayushdevel1...@gmail.com>
Sent: Wednesday, July 13, 2022 9:45 AM
To: devel@edk2.groups.io
Cc: Kinney, Michael D <michael.d.kin...@intel.com>;
mikub...@linux.microsoft.com; Gaibusab, Jabeena B
<jabeena.b.gaibu...@intel.com>; Yao, Jiewen <jiewen....@intel.com>
Subject: [NetworkPkg] Clarification on EFI_TCP6_PROTOCOL Destruction Behavior
Hello everyone. I am trying to implement Network Support in Rust std for
UEFI. While trying to use the TCP6_PROTOCOL, I am not quite sure how to
deal with destructing the protocol. Since TCP6_PROTOCOL is created using
a EFI_SERVICE_BINDING_PROTCOL, it should be destroyed using the
`DestroyChild()` method. However, do I also have to call
`TCP6_PROTOCOL->Close()` before this or will `DestroyChild()` do that
implicitly? If I do have to call this method myself, then do I need to
do `DestroyChild()` in the `CloseToken->Event->NotifyFunction` or is it
fine to `DestroyChild()` after calling `Close()` (event though `Close`
is nonblocking) ?
Also, it would be great if someone can point me to some TCP Network
applications. I did find some but most were either drivers, or were very
simple and did not do any Cleanup stuff.
Note: Rust does not need the user to close the connection manually. It
is closed once the object is dropped (which is done once the object
owner goes out of scope at compile time).
Yours Sincerely
Ayush Singh
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91421): https://edk2.groups.io/g/devel/message/91421
Mute This Topic: https://groups.io/mt/92361755/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-