Hosts File For Cafe

Table of Contents

Introduction

Overview

A hosts file is one that maps IP addresses to hostnames. Typically it is stored in a system directory and used to translate hostnames into IP addresses. Cafe has no such support in production mode. Instead, during development, Cafe can read a hosts file from SD card formatted with the FAT file system.

Cafe's hosts file format is similar to other systems (UNIX, Windows, etc.) and provides similar functionality. It is loaded from SD card when the system boots and all of the entries in the hosts file are stored in the system.

When an application looks up an IP address/hostname using SOGetHostByName/SOGetHostByAddr, first the system looks at the hosts file database. If the IP address/hostname is found in the database, it is returned without issuing a DNS request. Normal DNS processing is performed if the corresponding entry is not found in the database.

Limitations

Hosts File Format

The format of the Cafe hosts file is almost same as other systems.

Example

# Copyright (C) 2013 Nintendo. All rights reserved.
#
# This is a hosts file sample for Cafe.
#
# [Description]
# The format of each entry has to be like as below.
# ip_address host_name [alias...]
#     Example:
#     127.0.0.1   localhost LOCAL_HOST loopback
#     192.168.0.1 default_gateway first_hop MYROUTER
#
# - Corresponding members need to be defined in the same line
# - Each member (ip_address, host_name and alias) needs to be delimited by space
#   or tab (multiple spaces and tabs are allowed between each members)
# - Characters which are followed by '#' symbol are treated as a comment
# - Blank line is ignored
# - Multiple aliases can be defined
# - Each string length of host_name and aliases has to be less than 128
# - This feature is available only on DEBUG mode, not available on PROD mode
# - Only UTF-8 is supported as a text encode (BOM is not supported)
# - LF and CR+LF are supported as a line break

# [Usage]
# - Place this file in SD_CARD_ROOT/cafe/net/etc/
# - Insert the SD card to the SD card slot on Wii U before system boots
# - Turn on Wii U and launch an application
127.0.0.1     local_host local_host_alias
192.168.0.1   default_gateway first_hop MYROUTER 

Usage

Revision History

2014/08/08 Initial version.


CONFIDENTIAL