Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Network Node ID Help

tomballard
Beginner
810 Views
My software requires that I obtain the network node identifier of the network card and I should be able to obtain this at run time using the GetClusterNodeID API. However, the code show below results in an unsatisfied external for GetClusterNodeID when I link the program. Any suggestions? Am I missing a module or library (I am linking with clusapi.lib.



use dfport

integer*4 NodeIDCount,hNode
character*256 NodeID


lpszNodeID = loc(NodeID)
NodeIDCount = 256
lpcchNodeID = loc(NodeIDCount)
hNode = NULL
istatus = GetClusterNodeID(hNode,lpszNodeID,lpcchNodeID)

0 Kudos
10 Replies
Steven_L_Intel1
Employee
810 Views
CVF doesn't include declarations for routines in clusapi.lib. You'll have to write your own INTERFACE block for it.

Steve
0 Kudos
tomballard
Beginner
810 Views
Thanks Steve... Now can anyone tell me what the interface should look like. Declaring an integer function with integer arguements still gives me an unsatisfied external reference. Has anyone out there written the interface to GetClusterNodeID?
0 Kudos
Jugoslav_Dujic
Valued Contributor II
810 Views

INTERFACE
INTEGER FUNCTION GetClusterNodeId(hNode,lpszNodeID,lpcchNodeID)
!DEC$ATTRIBUTES STDCALL, ALIAS: "_GetClusterNodeId@12":: GetClusterNodeId
INTEGER:: hNode, lpszNodeID, lpcchNodeID
END FUNCTION
END INTERFACE

Of course, don't forget to add Clusapi.lib to Project/Settings/Link.

Jugoslav
0 Kudos
Steven_L_Intel1
Employee
810 Views
I could give you the interface (and will), but I don't think it will help you. Did you spot the note in the documentation that this service was available for Windows NT Enterprise Server Edition 4.0 only?

If you still want to use it, the interface would be:

interface
  integer(SINT) function GetClusterNodeId (hnode, &
    lpszNodeID, lpcchNodeID)
  !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE :: GetClusterNodeID
  !DEC$ ATTRIBUTES ALIAS:"GetClusterNodeId" :: GetClusterNodeID
  INTEGER(HANDLE), INTENT(IN) :: hnode
  INTEGER(LPWSTR), INTENT(OUT) :: lpszNodeID
  !DEC$ ATTRIBUTES REFERENCE ::lpszNodeID
  INTEGER(DWORD), INTENT(INOUT) :: lpcchNodeID
  !DEC$ ATTRIBUTES REFERENCE :: lpcchNodeID
  end function GetClusterNodeId
end interface


Offhand, I don't know how you would retrieve the Ethernet address.
0 Kudos
tomballard
Beginner
810 Views
Thanks jugoslavdujic... I left out the alias.
0 Kudos
tomballard
Beginner
810 Views
OK Steve, you're right as usual. The procedure compiles and links, but doesn't return anything when I make the call. I am attempting to write a nodelock proceedure and need to retrieve the physical address of the network card. Is there any way that you know of to do this other than with GetClusterNodeID? Is there a registry entry containing this address or am I out of luck?
0 Kudos
Steven_L_Intel1
Employee
810 Views
I dunno. Maybe one of the NDIS functions? I found one that gets a software address from the registry, but I don't think that's what you want.

Would be a good question for the Win32 programming newsgroup - just ask which Win32 API routine returns the hardware MAC address of the Ethernet adapter. Keep in mind that some systems have more than one Ethernet adapter, so you probably need to enumerate them and query them all.

Steve
0 Kudos
james1
Beginner
810 Views
See http://codeguru.earthweb.com/network/GetMAC.html for a number of different methods.

James
0 Kudos
tomballard
Beginner
810 Views
Thanks elementyl.... however, it appears that all the methods discussed in your link are either not supported on NT or not supported in CVF. At least, I could not find the required interfaces and structures in the CVF modules in the DF98 include folder. Maybe the best way to get the network adapter id is through a call to a C++ procedure, such as the one shown on the web page you refered me to. Anyway, thanks... I'll keep looking.
0 Kudos
james1
Beginner
810 Views
Well, don't let that deter you. If I stopped every time CVF didn't have an interface for something I would have quit a long time ago. :-) In these cases you simply need to define the data structure(s) and the necessary call interface(s) for your method of choice and it is certainly no problem to implement any of those methods in CVF.

James
0 Kudos
Reply