[DECtec] Calling All VAXELN Programmers

Dave McGuire mcguire at neurotica.com
Thu Jan 21 06:01:49 GMT 2016


  It'd be great if you'd put up a start-to-finish "here's how to develop
an application under VAXELN" page.  Can you be talked into that?

              -Dave

On 01/19/2016 05:16 PM, Robert Jarratt wrote:
> I am trying to get some C code working to connect to the Ethernet card,
> using eln$ni_connect. But it doesn't seem to be working. Can anyone offer
> any advice?
> 
>  
> 
> The code I have is below. Note that I am trying to emulate little bits of
> the pcap library. I know the strncmp call is not very robust, but it works
> for now. It produces the following output:
> 
>  
> 
> 1970-01-01 00:00:00 EPL pcap_open_live() called for device XQA0
> 
> 1970-01-01 00:00:00 EPL Checking device XQA0 against XQA0 found at 0
> 
> 1970-01-01 00:00:00 EPL Create dispatch port status KERNEL-S-SUCCESS, normal
> successful completion(1)
> 
> 1970-01-01 00:00:00 EPL Failed to connect to XQA0. Error is NONAME-F-NOMSG,
> Message number 00000000C. Portal id is 2147480264
> 
>  
> 
> Thanks
> 
>  
> 
> Rob
> 
>  
> 
> pcap_t *pcap_open_live (const char *device, int snaplen, int promisc, int
> to_ms, char *ebuf)
> 
> {
> 
>     pcap_t *result = NULL;
> 
>     int status;
> 
>     int count;
> 
>     int portalId;
> 
>     PORT dispatchPort;
> 
>     pcap_vaxeln_t *connection;
> 
>     struct eln$ni_configuration config;
> 
>     int i;
> 
>     static struct pcap_if dev[8];
> 
>  
> 
>     Log(LogEthPcapLine, LogInfo, "pcap_open_live() called for device %s\n",
> device);
> 
>  
> 
>     eln$ni_get_configuration(&status, &count, &config);
> 
>  
> 
>     if (status == ELN$_SUCCESS)
> 
>     {
> 
>         for (i = 0; i < count; i++)
> 
>         {
> 
>             if (strncmp(device, config.clist.list[i].name.string_text,
> config.clist.list[i].name.string_length)==0)
> 
>             {
> 
>                 break;
> 
>             }
> 
>         }
> 
>  
> 
>         if (i >= count)
> 
>         {
> 
>             Log(LogEthPcapLine, LogError, "Device %s does not exist\n",
> device);
> 
>         }
> 
>         else
> 
>         {
> 
>             ker$create_port(&status, &dispatchPort, 4);
> 
>             Log(LogEthPcapLine, LogInfo, "Create dispatch port status
> %s(%d)\n", GetMsg(status), status);
> 
>             eln$ni_connect(&status, &portalId,
> config.clist.list[i].control_port, &dispatchPort, NULL, NULL, &promisc,
> NULL, NULL, NULL, NULL, NULL, NULL);
> 
>             if (status % 2)
> 
>             {
> 
>                 Log(LogEthPcapLine, LogInfo, "Connected to %s. Portal id is
> %d\n", device, portalId);
> 
>                 connection = (pcap_vaxeln_t *)malloc(sizeof(pcap_vaxeln_t));
> 
>                 memcpy(&connection->dispatchPort, &dispatchPort,
> sizeof(PORT));
> 
>                 connection->portalId = portalId;
> 
>                 result = (pcap_t *)connection;
> 
>             }
> 
>             else
> 
>             {
> 
>                 Log(LogEthPcapLine, LogError, "Failed to connect to %s.
> Error is %s. Portal id is %d\n", device, GetMsg(status), status);
> 
>                 ker$delete(NULL, dispatchPort);
> 
>             }
> 
>         }
> 
>     }
> 
>     else
> 
>     {
> 
>         Log(LogEthPcapLine, LogError, "eln$ni_get_configuration failed with
> status %s(%d)\n", GetMsg(status), status);
> 
>     }
> 
>  
> 
>     return result;
> 
> }
> 


-- 
Dave McGuire, AK4HZ
New Kensington, PA




More information about the DECtec mailing list