[Winpcap-users] Packet32.h(209) : error C2079: 'IPAddress' uses undefined struct 'sockaddr_storage'

Vasily Borovyak vbor at isd.dp.ua
Thu Jun 22 05:08:43 GMT 2006


Hi Steven.

Simply try to include *Winsock2.h*.
Here is MSDN:


  SOCKADDR_STORAGE

The *SOCKADDR_STORAGE* structure stores socket address information. 
Since the *SOCKADDR_STORAGE* structure is sufficiently large to store 
IPv4 or IPv6 address information, or others, its use promotes 
protocol-family and protocol-version independence, and simplifies 
cross-platform development. Use the *SOCKADDR_STORAGE* structure in 
place of the *sockaddr* <sockaddr_2.htm> structure.

typedef struct sockaddr_storage {
  short ss_family;
  char __ss_pad1[_SS_PAD1SIZE];
  __int64 __ss_align;
  char __ss_pad2[_SS_PAD2SIZE];
} SOCKADDR_STORAGE, 
*PSOCKADDR_STORAGE;


        Members

*ss_family*
    Address family of the socket, such as AF_INET. 
*__ss_pad1*
    Reserved. Defined as a 48-bit pad that ensures *SOCKADDR_STORAGE*
    achieves 64-bit alignment. 
*__ss_align*
    Reserved. Used by the compiler to align the structure. 
*__ss_pad2*
    Reserved. Used by the compiler to align the structure. 


        Remarks

Application developers use only the *ss_family* member of the 
*SOCKADDR_STORAGE*. The remaining three members ensure the 
*SOCKADDR_STORAGE* is padded appropriately to achieve 64-bit alignment. 
Such alignment enables protocol-specific socket address data structures 
to access fields within a *SOCKADDR_STORAGE* structure without alignment 
problems. With its padding, the *SOCKADDR_STORAGE* structure is 128 
bytes in length.

The member field of the *SOCKADDR_STORAGE* structure is isomorphic with 
the *sockaddr* <sockaddr_2.htm> structure to enable simplified 
transition from sockaddr to *SOCKADDR_STORAGE*.

For more information about platform-independent *SOCKADDR_STORAGE* 
implementation recommendations, refer to RFC 2553, available at 
www.ietf.org <http://www.ietf.org>.


        Requirements

*Client: *Requires Windows XP.
*Server: *Requires Windows Server 2003.
*Header: *Declared in _*Winsock2.h*_.



Steven Smethurst wrote:
>
> Hello
>
>  
>
> I am trying to build one of the examples that came with Winpcap 
> version 3.1
>
> \Examples-remote\PacketDriver\GetMacAddress
>
>  
>
> And I am getting the following errors
>
> Compiling...
>
> GetMacAddress.c
>
> c:\dev\sdk\wpdpack\include\packet32.h(209) : error C2079: 'IPAddress' 
> uses undefined struct 'sockaddr_storage'
>
> c:\dev\sdk\wpdpack\include\packet32.h(210) : error C2079: 'SubnetMask' 
> uses undefined struct 'sockaddr_storage'
>
> c:\dev\sdk\wpdpack\include\packet32.h(211) : error C2079: 'Broadcast' 
> uses undefined struct 'sockaddr_storage'
>
>  
>
>  
>
> Snippet from c:\dev\sdk\wpdpack\include\packet32.h
>
> --------------------------------------------------------------------
>
> /*!
>
>   \brief Addresses of a network adapter.
>
>  
>
>   This structure is used by the PacketGetNetInfoEx() function to 
> return the IP addresses associated with
>
>   an adapter.
>
> */
>
>  
>
> typedef struct npf_if_addr {
>
>             struct sockaddr_storage IPAddress;        ///< IP address.
>
>             struct sockaddr_storage SubnetMask;     ///< Netmask for 
> that address.
>
>             struct sockaddr_storage Broadcast;        ///< Broadcast 
> address.
>
> }npf_if_addr;
>
> --------------------------------------------------------------------
>
>  
>
>  
>
>  
>
> I am able to build all the \Examples-pcap example with out any problems.
>
> Any help or suggestions would be greatly appreciated.
>
>  
>
>  
>
> Using WinPcap version 3.1
>
> With Visual studios 6.0
>
> I have also updated my platformsdk
>
> http://www.microsoft.com/msdownload/platformsdk/sdkupdate
>
>  
>
>  
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Winpcap-users mailing list
> Winpcap-users at winpcap.org
> https://www.winpcap.org/mailman/listinfo/winpcap-users
>   

-- 
Best regards. Vasily Borovyak <vbor at isd.dp.ua>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20060622/097c789f/attachment-0001.htm


More information about the Winpcap-users mailing list