MOD54417-Multi-Interface example
Posted: Tue Oct 21, 2014 4:58 pm
There appears to have been a little bit of confusion with regards to how to work with the new MOD54417 that I'd like to be able to clear up. To that end, I've put together an example which has some information and how to do get started with some useful things with the dual interfaces.
First up, the example has a nice overview of the network initialization for the MOD54417 I'll copy below:
Second, we've added a couple new comphtml tags to support multi interface websites segregating authority; they are 'IFNUM' and 'NODIRECT'. These will not be available until the next release however. The behavior of these tags are:
-Dan
First up, the example has a nice overview of the network initialization for the MOD54417 I'll copy below:
Code: Select all
/*******************************************************************************
* MOD54417 Network Operation Overview *
* ------------------------------------ *
* The MOD54417's software drivers are designed to be fully transparent and *
* perform all necessary configurations using the same function calls as the *
* MOD54415. So, what are the relevant function calls and what do they do *
* differently between the MOD54415 and the MOD54417? *
* *
* Hardware Initialization *
* ------------------------ *
* The hardware initialization for the network stack ocurrs in *
* InitializeStack(). At the bottom, this function breaks out of the main *
* system library when it calls AddEthernetInterface(). Inside this call, there*
* is a check that determines if the software is running on a MOD54415 or a *
* MOD54417. If it is running on a MOD54417 it then checks to see if it should *
* be running in switched mode or independent mode. By the time the function *
* returns, the network hardware is configured accordingly and the interface(s)*
* are added to the stack (if the device is in switched mode, only one *
* interface is created, due to the nature of the switch). Add2ndEthernet() *
* should never be called in normal application development. If the module *
* should switch between switched and independent modes, the config record *
* must be updated and then the module be reset. *
* *
* Network Configurations *
* ----------------------- *
* When the ethernet interfaces are operating in independent mode, the second *
* ethernet interface will get its configuration from ConfigRecord number *
* CONFIG_IF_ID_ETHERNET2. It will appear under IPSetup. In most ways, the *
* second interface will behave as the first, with a few minor exceptions. *
* *
* 1. The link status functions will now operate on the driver objects. *
* Example: EtherLink() becomes enet0.EtherLink() or enet1.EtherLink() *
* 2. All the calls with Ethernet* (EthernetIP, EthernetIpMask, EthernetIpGate,*
* EthernetDNS) will need to need to be changed to work with the *
* NetInterface functions for querying the different addresses, or obtaining*
* the InterfaceBlock for the correct interface. These can be obtained by *
* the oppropriate call as follows: *
* InterfaceBlock *pifb = GetInterFaceBlock( enet0.myInterfaceNumber ); *
* Once you have the block, the you can then set the individual addresses. *
* *
* GetDHCPAddressIfNecessary *
* -------------------------- *
* GetDHCPAddressIfNecessary has been modified in the default case. The default*
* argument is -1. When this value is passed, GetDHCPAddressIfNecessary will *
* start DHCP negotiations on all network interfaces that do not already have *
* either, a valid IP address, a DHCP object associated, or an AutoIP object *
* associated. *
*******************************************************************************/
Finally, I'm attaching the source as well as an image to see how it will work (due to the lack of current support for the new tags).
- IFNUM creates a whitelist based discrimination for web requests based on the interface that the request comes from.
Without a IFNUM tag the page is available to all interfaces. If any IFNUM tag is present, it is only available to those interfaces which
are listed in seperate tags.- NODIRECT disables serving a page entirely to direct web requests. It allows for the creation of sub-template pages, only available
to dynamic code functions to serve up with the SendData command.
-Dan