public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ayush Singh" <ayushdevel1325@gmail.com>
To: "Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"mikuback@linux.microsoft.com" <mikuback@linux.microsoft.com>,
	"Gaibusab, Jabeena B" <jabeena.b.gaibusab@intel.com>,
	"Yao, Jiewen" <jiewen.yao@intel.com>
Subject: Re: [NetworkPkg] Clarification on EFI_TCP6_PROTOCOL Destruction Behavior
Date: Sat, 16 Jul 2022 02:33:30 +0530	[thread overview]
Message-ID: <fd132b99-78e1-a6a3-24c0-527fd1dfbb0f@gmail.com> (raw)
In-Reply-To: <CA+Yfj7uVxA_5J90kVUf5xc1VsC=FK85qMhh0sgWyDcZ6vCAtNg@mail.gmail.com>

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.kinney@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 <ayushdevel1325@gmail.com>
>>> Sent: Wednesday, July 13, 2022 9:45 AM
>>> To: devel@edk2.groups.io
>>> Cc: Kinney, Michael D <michael.d.kinney@intel.com>; mikuback@linux.microsoft.com; Gaibusab, Jabeena B
>>> <jabeena.b.gaibusab@intel.com>; Yao, Jiewen <jiewen.yao@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

      reply	other threads:[~2022-07-15 21:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-13 16:44 [NetworkPkg] Clarification on EFI_TCP6_PROTOCOL Destruction Behavior Ayush Singh
2022-07-13 17:36 ` Michael D Kinney
2022-07-13 18:30   ` Ayush Singh
2022-07-15 21:03     ` Ayush Singh [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fd132b99-78e1-a6a3-24c0-527fd1dfbb0f@gmail.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox