Changeset aba138b in rtems


Ignore:
Timestamp:
Feb 11, 2003, 11:04:41 PM (18 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
593904c
Parents:
83e36d6b
Message:

2003-02-11 Mike Siers <mikes@…>

  • networkapp.t: Add an example code snippet for adding an IP alias.
Location:
doc/networking
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • doc/networking/ChangeLog

    r83e36d6b raba138b  
     12003-02-11      Mike Siers <mikes@poliac.com>
     2
     3        * networkapp.t: Add an example code snippet for adding an IP alias.
     4
    152003-01-25      Ralf Corsepius <corsepiu@faw.uni-ulm.de>
    26
  • doc/networking/networkapp.t

    r83e36d6b raba138b  
    422422sockets.
    423423
     424@subsection Adding an IP Alias
     425
     426The following code snippet adds an IP alias:
     427
     428@example
     429void addAlias(const char *pName, const char *pAddr, const char *pMask)
     430@{
     431  struct ifaliasreq      aliasreq;
     432  struct sockaddr_in    *in;
     433
     434  /* initialize alias request */
     435  memset(&aliasreq, 0, sizeof(aliasreq));
     436  sprintf(aliasreq.ifra_name, pName);
     437
     438  /* initialize alias address */
     439  in = (struct sockaddr_in *)&aliasreq.ifra_addr;
     440  in->sin_family = AF_INET;
     441  in->sin_len    = sizeof(aliasreq.ifra_addr);
     442  in->sin_addr.s_addr = inet_addr(pAddr);
     443
     444  /* initialize alias mask */
     445  in = (struct sockaddr_in *)&aliasreq.ifra_mask;
     446  in->sin_family = AF_INET;
     447  in->sin_len    = sizeof(aliasreq.ifra_mask);
     448  in->sin_addr.s_addr = inet_addr(pMask);
     449
     450  /* call to setup the alias */
     451  rtems_bsdnet_ifconfig(pName, SIOCAIFADDR, &aliasreq);
     452@}
     453@end example
     454
     455Thanks to @uref{mailto:imikes@@poliac.com,Mike Seirs} for this example
     456code.
     457
    424458@subsection Time Synchronization Using NTP
    425459
Note: See TracChangeset for help on using the changeset viewer.