]>
git.proxmox.com Git - mirror_edk2.git/blob - AppPkg/Applications/Sockets/GetNetByName/GetNetByName.c
2 Translate the network name into an IP address
4 Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
13 #include <Library/DebugLib.h>
14 #include <Library/UefiLib.h>
16 #include <sys/socket.h>
21 /** Translate the network name into an IP address
23 @param[in] Argc The number of arguments
24 @param[in] Argv The argument value array
26 @retval 0 The application exited normally.
27 @retval Other An error occurred.
36 struct netent
* pNetwork
;
42 // Determine if the network name is specified
44 Print ( L
"%a <network name>\r\n", Argv
[0]);
47 // Translate the net name
48 pNetwork
= getnetbyname ( Argv
[1]);
49 if ( NULL
== pNetwork
) {
50 Print ( L
"ERROR - network not found, errno: %d\r\n", errno
);
53 pIpAddress
= (UINT8
*)(UINTN
)&pNetwork
->n_net
;
54 Print ( L
"%a: Type %d, %d.%d.%d.%d\r\n",