Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7862531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:09:55+00:00 2026-06-02T23:09:55+00:00

I am trying to get the ARP entries on my iPad like here .

  • 0

I am trying to get the ARP entries on my iPad like here.

When compiling the code to run on my iPad (so not the simulator) I am getting missing header error messages. You can resolve them by copying the header files into you project locally as mentioned in this post.

The problem lies in the line

sdl = (struct sockaddr_dl *)(sin + 1);

in this piece of code:

-(NSString*) ip2mac: (char*) ip 
{ 

    int expire_time, flags, export_only, doing_proxy, found_entry; 

    NSString *mAddr = nil; 
    u_long addr = inet_addr(ip); 
    int mib[6]; 
    size_t needed; 
    char *host, *lim, *buf, *next; 
    struct rt_msghdr *rtm; 
    struct sockaddr_inarp *sin; 
    struct sockaddr_dl *sdl; 
    extern int h_errno; 
    struct hostent *hp; 

    mib[0] = CTL_NET; 
    mib[1] = PF_ROUTE; 
    mib[2] = 0; 
    mib[3] = AF_INET; 
    mib[4] = NET_RT_FLAGS; 
    mib[5] = RTF_LLINFO; 
    if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) 
        err(1, "route-sysctl-estimate"); 
    if ((buf = malloc(needed)) == NULL) 
        err(1, "malloc"); 
    if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) 
        err(1, "actual retrieval of routing table"); 


    lim = buf + needed; 
    for (next = buf; next < lim; next += rtm->rtm_msglen) { 
        rtm = (struct rt_msghdr *)next; 
        sin = (struct sockaddr_inarp *)(rtm + 1); 
        sdl = (struct sockaddr_dl *)(sin + 1); 
        if (addr) { 
            if (addr != sin->sin_addr.s_addr) 
                continue; 
            found_entry = 1; 
        } 
        if (nflag == 0) 
            hp = gethostbyaddr((caddr_t)&(sin->sin_addr), 
                               sizeof sin->sin_addr, AF_INET); 
        else 
            hp = 0; 
        if (hp) 
            host = hp->h_name; 
        else { 
            host = "?"; 
            if (h_errno == TRY_AGAIN) 
                nflag = 1; 
        } 



        if (sdl->sdl_alen) { 

            u_char *cp = LLADDR(sdl); 

            mAddr = [NSString stringWithFormat:@"%x:%x:%x:%x:%x:%x", cp[0], cp[1], cp[2], cp[3], cp[4], cp[5]]; 


        //  ether_print((u_char *)LLADDR(sdl)); 
        } 
        else 

            mAddr = nil; 



    } 


    if (found_entry == 0) { 
        return nil; 
    } else { 
        return mAddr; 
    } 




} 

It gives the following error message:

Arithmetic on pointer to incomplete type ‘struct sockaddr_inarp*’

When you compile the code for the iPad simulator everything runs fine.

Does anyone have an idea how to solve this?
A similar question (but not solved) is asked here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T23:10:00+00:00Added an answer on June 2, 2026 at 11:10 pm

    After importing <netinet/if_ether.h>, you should edit it and change the line

    #include <net/if_arp.h>
    

    to

    #include "if_arp.h"
    

    and then import <net/if_arp.h> in your project as well. This should fix that error.

    Anyway the headers you need to import to compile the code you posted are:

    #include "if_ether.h"
    #include "route.h"
    #include "if_arp.h"
    #include "if_dl.h"
    

    Hope this helps =)

    EDIT:

    You need to “Add files to project”, not simply importing it with #import or #include.
    You can find above files from following links:
    Files under “netinet”
    Files under “net”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying get the data from my database but i am not getting
I am trying to get the ARP table in Linux to an array with
I'm trying to get a web app working based on the S#arp Architecture. At
I am trying get my head around how you can run the following php:
I'm trying get some licensing code from AndroidPit.com working, but I get Unable to
I'm trying get a basic circular temperature contour graph in MATLAB. Instead, I'm getting
I am trying get a Form's BindingSource using Reflection. The following code is what
I am trying to get a simple prototype using ASP.NET S#arp-architecture (Sharp architecture) to
I'm new to Drupal and trying get my head around it. I'd like to
I am trying get my first simple project in rails to run. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.