Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

LibHTTP4.HttpResolveCache


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
/*******************************************************************************
    HttpResolveCache                                                            <br />
    Object that holds cached resolves. this is used by multiple HttpSock
    instances
                                                                                <br />
    Dcoumentation and Information:
        http://wiki.beyondunreal.com/wiki/LibHTTP                               <br />
                                                                                <br />
    Authors:    Michiel 'El Muerte' Hendriks <elmuerte@drunksnipers.com>  <br />
                                                                                <br />
    Copyright 2005 Michiel "El Muerte" Hendriks                                 <br />
    Released under the Lesser Open Unreal Mod License                           <br />
    http://wiki.beyondunreal.com/wiki/LesserOpenUnrealModLicense                <br />

    <!-- $Id: HttpResolveCache.uc,v 1.1 2005/05/29 20:07:52 elmuerte Exp $ -->
*******************************************************************************/

class HttpResolveCache extends Core.Object;

/** resolve chache entry to speed up subsequent request */
struct ResolveCacheEntry
{
    /** the hostname */
    var string Hostname;
    /** the address information */
    var InternetLink.IpAddr Address;
};
/** Resolve cache, already resolved hostnames are not looked up.
    You have to keep the actor alive in order to use this feature */
var protected array<ResolveCacheEntry> ResolveCache;

/** lookup a resolved address */
function bool ResolveAddress(string hostname, out InternetLink.IpAddr Address)
{
    local int i;
    for (i = 0; i < ResolveCache.Length; i++)
    {
        if (ResolveCache[i].Hostname ~= hostname)
        {
            Address = ResolveCache[i].Address;
            return true;
        }
    }
    return false;
}

/** add an entry */
function AddCacheEntry(string hostname, InternetLink.IpAddr Address)
{
    ResolveCache.Length = ResolveCache.Length+1;
    ResolveCache[ResolveCache.length-1].Hostname = hostname;
    ResolveCache[ResolveCache.length-1].Address = Address;
}


Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: So 29.5.2005 22:07:52.000 - Creation time: Do 14.8.2014 09:58:40.619 - Created with UnCodeX