Re: data structure initialization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I apologize for last incomplete mail, please ignore it:
I have came across, this kind of structure initialization for the first time:

static const struct icmp_control icmp_pointers[NR_ICMP_TYPES + 1] = {
        [ICMP_ECHOREPLY] = {
                .output_entry = ICMP_MIB_OUTECHOREPS,
                .input_entry = ICMP_MIB_INECHOREPS,
                .handler = icmp_discard,
        },
        [1] = {
                .output_entry = ICMP_MIB_DUMMY,
                .input_entry = ICMP_MIB_INERRORS,
                .handler = icmp_discard,
                .error = 1,
        },
        [2] = {
                .output_entry = ICMP_MIB_DUMMY,
                .input_entry = ICMP_MIB_INERRORS,
                .handler = icmp_discard,
                .error = 1,
        },
        [ICMP_DEST_UNREACH] = {
                .output_entry = ICMP_MIB_OUTDESTUNREACHS,
                .input_entry = ICMP_MIB_INDESTUNREACHS,
                .handler = icmp_unreach,
                .error = 1,
        },
        [ICMP_SOURCE_QUENCH] = {
                .output_entry = ICMP_MIB_OUTSRCQUENCHS,
                .input_entry = ICMP_MIB_INSRCQUENCHS,
                .handler = icmp_unreach,
                .error = 1,
        },
        [ICMP_REDIRECT] = {
                .output_entry = ICMP_MIB_OUTREDIRECTS,
                .input_entry = ICMP_MIB_INREDIRECTS,
                .handler = icmp_redirect,
                .error = 1,
        },
        [6] = {
                .output_entry = ICMP_MIB_DUMMY,
                .input_entry = ICMP_MIB_INERRORS,
                .handler = icmp_discard,
        },
         [7] = {
                .output_entry = ICMP_MIB_DUMMY,
                .input_entry = ICMP_MIB_INERRORS,
                .handler = icmp_discard,
                .error = 1,
        },
        [ICMP_ECHO] = {
                .output_entry = ICMP_MIB_OUTECHOS,
                .input_entry = ICMP_MIB_INECHOS,
                .handler = icmp_echo,
        },
        [9] = {
                .output_entry = ICMP_MIB_DUMMY,
                .input_entry = ICMP_MIB_INERRORS,
                .handler = icmp_discard,
                .error = 1,
        },
        [10] = {
                .output_entry = ICMP_MIB_DUMMY,
                .input_entry = ICMP_MIB_INERRORS,
                .handler = icmp_discard,
                .error = 1,
        },
        [ICMP_TIME_EXCEEDED] = {
                .output_entry = ICMP_MIB_OUTTIMEEXCDS,
                .input_entry = ICMP_MIB_INTIMEEXCDS,
                .handler = icmp_unreach,
                .error = 1,
        },
        [ICMP_PARAMETERPROB] = {
                .output_entry = ICMP_MIB_OUTPARMPROBS,
                .input_entry = ICMP_MIB_INPARMPROBS,
                .handler = icmp_unreach,
                .error = 1,
        },
        [ICMP_TIMESTAMP] = {
                .output_entry = ICMP_MIB_OUTTIMESTAMPS,
                .input_entry = ICMP_MIB_INTIMESTAMPS,
 .handler = icmp_timestamp,
        },
        [ICMP_TIMESTAMPREPLY] = {
                .output_entry = ICMP_MIB_OUTTIMESTAMPREPS,
                .input_entry = ICMP_MIB_INTIMESTAMPREPS,
                .handler = icmp_discard,
        },
        [ICMP_INFO_REQUEST] = {
                .output_entry = ICMP_MIB_DUMMY,
                .input_entry = ICMP_MIB_DUMMY,
                .handler = icmp_discard,
        },
        [ICMP_INFO_REPLY] = {
                .output_entry = ICMP_MIB_DUMMY,
                .input_entry = ICMP_MIB_DUMMY,
                .handler = icmp_discard,
        },
        [ICMP_ADDRESS] = {
                .output_entry = ICMP_MIB_OUTADDRMASKS,
                .input_entry = ICMP_MIB_INADDRMASKS,
                .handler = icmp_address,
        },
        [ICMP_ADDRESSREPLY] = {
                .output_entry = ICMP_MIB_OUTADDRMASKREPS,
                .input_entry = ICMP_MIB_INADDRMASKREPS,
                .handler = icmp_address_reply,
        },
};


I am not sure what those indexes are for: for example [ICMP_ADDRESSREPLY].
The above code is taken from "icmp.c"

Regards
Anuz

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux