public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Michael D Kinney" <michael.d.kinney@intel.com>
To: Ayush Singh <ayushdevel1325@gmail.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: "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: Wed, 13 Jul 2022 17:36:07 +0000	[thread overview]
Message-ID: <CO1PR11MB492997B72255692FC917CC97D2899@CO1PR11MB4929.namprd11.prod.outlook.com> (raw)
In-Reply-To: <a7b2efcb-f837-70f7-491e-52f56346ba16@gmail.com>

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-13 17:37 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 [this message]
2022-07-13 18:30   ` Ayush Singh
2022-07-15 21:03     ` Ayush Singh

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=CO1PR11MB492997B72255692FC917CC97D2899@CO1PR11MB4929.namprd11.prod.outlook.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