Author Topic: Is it OK to add items to NETWORK_PARAMETERS struct?  (Read 7637 times)

Offline thamanjd

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Is it OK to add items to NETWORK_PARAMETERS struct?
« on: April 23, 2008, 09:41:50 AM »
ive added a few bits and pieces to struct PARS which hasn't caused me any problems yet. I wondered if there would be a problem memory wise with adding anything to NETWORK_PARAMETERS struct

i was playing with adding a multicast ip to the ip filter and thought the struct would be the most likely place to save it.

Code: [Select]
typedef struct stNETWORK_PARAMETERS
{
    unsigned short usNetworkOptions;                                     // Options passed to the network device on configuration
    unsigned char  ucOurMAC[MAC_LENGTH];                                 // when no other value can be read from parameters this will be used
    unsigned char  ucOurIP[IPV4_LENGTH];                                 // our default IP address
    unsigned char  ucNetMask[IPV4_LENGTH];                               // Our default network mask
    unsigned char  ucDefGW[IPV4_LENGTH];                                 // Our default gateway
    unsigned char  ucDNS_server[IPV4_LENGTH];                            // Our default DNS server
    unsigned char  ucOurMulticastIP[IPV4_LENGTH];                        // our default MulticastIP
} NETWORK_PARAMETERS;

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: Is it OK to add items to NETWORK_PARAMETERS struct?
« Reply #1 on: April 23, 2008, 11:35:26 AM »
Hi

The only disadvantage of the parameter here is that it is defined in tcpip.h, which will be overwritten if a service pack is added with changes in this file - however it is not difficult to add it again of course.

The user parameters contains a version number which means that old parameter block in FLASH will be identified as no longer valid when the version number changes. Without such a mechanism  in the network struct it may be an idea to first delete all parameters before the change - this will  ensure that the default value is used the first time rather than whatever value happend to be in FLASH (probably 0xffffffff).

Regards

Mark