ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/hostmask.c
(Generate patch)

Comparing ircd-hybrid-8/src/hostmask.c (file contents):
Revision 1342 by michael, Sun Mar 25 11:24:18 2012 UTC vs.
Revision 1343 by michael, Sat Apr 7 18:46:29 2012 UTC

# Line 34 | Line 34
34  
35   #ifdef IPV6
36   static int try_parse_v6_netmask(const char *, struct irc_ssaddr *, int *);
37 < static unsigned long hash_ipv6(struct irc_ssaddr *, int);
37 > static uint32_t hash_ipv6(struct irc_ssaddr *, int);
38   #endif
39   static int try_parse_v4_netmask(const char *, struct irc_ssaddr *, int *);
40 < static unsigned long hash_ipv4(struct irc_ssaddr *, int);
40 > static uint32_t hash_ipv4(struct irc_ssaddr *, int);
41  
42   #define DigitParse(ch) do { \
43                         if (ch >= '0' && ch <= '9') \
# Line 361 | Line 361 | init_host_hash(void)
361   * Output: A hash value of the IP address.
362   * Side effects: None
363   */
364 < static unsigned long
364 > static uint32_t
365   hash_ipv4(struct irc_ssaddr *addr, int bits)
366   {
367    if (bits != 0)
368    {
369      struct sockaddr_in *v4 = (struct sockaddr_in *)addr;
370 <    unsigned long av = ntohl(v4->sin_addr.s_addr) & ~((1 << (32 - bits)) - 1);
370 >    uint32_t av = ntohl(v4->sin_addr.s_addr) & ~((1 << (32 - bits)) - 1);
371  
372      return (av ^ (av >> 12) ^ (av >> 24)) & (ATABLE_SIZE - 1);
373    }
# Line 381 | Line 381 | hash_ipv4(struct irc_ssaddr *addr, int b
381   * Side effects: None
382   */
383   #ifdef IPV6
384 < static unsigned long
384 > static uint32_t
385   hash_ipv6(struct irc_ssaddr *addr, int bits)
386   {
387 <  unsigned long v = 0, n;
387 >  uint32_t v = 0, n;
388    struct sockaddr_in6 *v6 = (struct sockaddr_in6 *)addr;
389  
390    for (n = 0; n < 16; n++)
# Line 411 | Line 411 | hash_ipv6(struct irc_ssaddr *addr, int b
411   * Output: The hash of the string between 1 and (TH_MAX-1)
412   * Side-effects: None.
413   */
414 < static int
414 > static uint32_t
415   hash_text(const char *start)
416   {
417    const char *p = start;
418 <  unsigned long h = 0;
418 >  uint32_t h = 0;
419  
420    while (*p)
421      h = (h << 4) - (h + (unsigned char)ToLower(*p++));
# Line 429 | Line 429 | hash_text(const char *start)
429   *         wildcard in the string.
430   * Side-effects: None.
431   */
432 < static unsigned long
432 > static uint32_t
433   get_mask_hash(const char *text)
434   {
435    const char *hp = "", *p;
# Line 456 | Line 456 | struct AccessItem *
456   find_conf_by_address(const char *name, struct irc_ssaddr *addr, int type,
457                       int fam, const char *username, const char *password)
458   {
459 <  unsigned long hprecv = 0;
459 >  unsigned int hprecv = 0;
460    struct AccessItem *hprec = NULL;
461    struct AddressRec *arec;
462    int b;
# Line 653 | Line 653 | add_conf_by_address(int type, struct Acc
653   {
654    const char *address;
655    const char *username;
656 <  static unsigned long prec_value = 0xFFFFFFFF;
656 >  static unsigned int prec_value = 0xFFFFFFFF;
657    int masktype, bits;
658 <  unsigned long hv;
658 >  uint32_t hv;
659    struct AddressRec *arec;
660  
661    address = aconf->host;
# Line 712 | Line 712 | void
712   delete_one_address_conf(const char *address, struct AccessItem *aconf)
713   {
714    int masktype, bits;
715 <  unsigned long hv;
715 >  uint32_t hv;
716    struct AddressRec *arec, *arecl = NULL;
717    struct irc_ssaddr addr;
718  

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)