Solaris: Programmatic interface to ifconfig? - network-programming

I'm looking for a programmatic interface to the Solaris ifconfig(1M) command.
Apparently Linux has the getifaddrs(3) command, but as far as I can tell this has not been ported to Solaris.
Short of attempting to use the code at the link above, is there any way to determine ifconfig(1M)-type data (network interface presence, state, etc.) without forking the system command and parsing the output?

I have an implementation here, IPv4-only based on SIOCGIFCONF ioctl()'s and IP family agnostic version using SIOCGLIFCONF:
http://code.google.com/p/openpgm/source/browse/trunk/openpgm/pgm/getifaddrs.c
Tested on SPARC/Solaris 10 and x86/OpenSolaris 2008.11 & 2009.06, LGPL 2.1 license.

getifaddrs() was recently integrated into the source code for future OpenSolaris & Solaris releases, but that doesn't help your code run on current releases:
6731945 need BSD getifaddrs() API
OpenSolaris source: usr/src/lib/libsocket/inet/getifaddrs.c
Until then you'll need to use the SIOCGLIFCONF ioctls, which you should find lots of examples of in open source code, including the link you posted.

Real men use ioctl ;)
Take a look at if(7P).

Related

Is it possible to update NodeMCU Lua files OTA?

I would love to be able to update my NodeMCU ESP8266-01 OTA, since they're located in awkward spots. I'm by no means an expert regarding the ESP or NodeMCU, but I haven't been able to find anything recent about OTA updates. I found some discussions about it going back to 2015, but it never seems to have been implemented.
I use my ESP with NodeMCU to control a PWM dimmer. I upload a precompiled version of NodeMCU with the NodeMCU Firmware FLasher, and then use ESPlorer to upload a custom lua file called 'init.lua'. I'm not even sure if this is the proper way to do stuff, but it works.
So the main question: Has OTA updating been implemented, or is it possible in some way?
Just to clarify, I don't think I want to update the firmware. As I understand it, firmware is what you build yourself, or on a website like https://nodemcu-build.com. I want to update the lua files that run on the ESP, that you normally upload through a program like ESPlorer.
I found some discussions about it going back to 2015, but it never seems to have been implemented.
Indeed, firmware OTA is not available yet. However, as you probably know, the need for firmware OTA is much lower with the NodeMCU firmware than e.g. with the Arduino platform. I'd argue that you're much less likely in need to replace/upgrade/extend the firmware with its built-in modules than the application code that runs on top of it.
Fortunately, it's quite simple to replace one or several Lua scripts (compiled or uncompiled) on the device and reboot it. All the web and cloud IDEs listed at https://frightanic.com/iot/tools-ides-nodemcu/ offer this. There's even a pending PR that'll bring FTP support to NodeMCU.
For a complete Lua provisioning system take a look at what #TerryE provided at https://github.com/nodemcu/nodemcu-firmware/tree/master/lua_examples/luaOTA
I've attempted to use the two Web IDEs listed in the link provided in Marcel Stör's answer, but I honestly failed to understand how to use either IDE. they also seemed like they weren't exactly what I was looking for, and required a server to connect to, or an extra program, which I wanted to avoid.
Edit: Apparently, I did end up using one of the two Web IDEs in the list. Since it's been a while since I did all this, it's a bit fuzzy in my head.
I eventually stumbled upon this GitHub page, which seemed to provide exactly what I was looking for: The ability to access the Lua files on the ESP through a webbrowser. I have personally changed the ide.lua file around completely, since I needed to call functions from it in the init.lua script. However, I think you can just upload the ide.lua script to the ESP, and add a line containing dofile("ide.lua") to your init.lua file.
If anyone is interested in my changes to, or my implementation of the ide.lua script, you can take a look at my repo Timmiej93 / QuinLED / Program code.
In fact there's a class for that to implement OTA i the NodeMCU its called the ESPhttpUpdate you can refer to ESPhttpUpdate for further details.

NDIS driver - how?

I have read nearly all of the material on Microsoft's MSDN site, used Google (for the limited information that is out there) and also looked at the answers on here but I'm still confused on how to develop a NDIS driver.
My aim is to create a ndis driver so I can capture the network packets and decide whether I want to drop them (possibly inject as well) or allow them to pass.
From my research it would seem that I need to create an intermediate NIDS driver and after installing WDK (I'm using Visual Studio 2015 enterprise) I don't know where to begin (do I need to start with a KMDF project?).
Also, when I did load a KMDF driver project nearly all of the header files are getting highlighted by Intellisense as having errors (expected an identifier, NTSTATUS is underefined)?
Can anyone give some assistance on how to start please?
I have recently created a packet sniffer using the WinPcap library (and also used it to send packets) but there was a lot of information out there that helped me. Unfortunately, with NDIS it doesn't seem to be the same.
I can't seem to find the samples either
Okay, so a simple clean install of Visual Studio 2015 and WDK 10 is all that is needed to set up the environment for creating a driver.....
But then comes the deployment part

Dart: Possible to exchange source code on the fly in a running system?

In this article it says: "The Dart VM reads and executes source code, which means there is no compile step between edit and run.". Does that mean that you can exchange source-code on the fly in a running Dart system like in Erlang? Maybe the compiler is removed from the runtime system and then this is no longer possible. So that's why I'm asking.
Dart is run "natively" only in Dartium, which is a flavour of Chrome with DartVM. When you develop an application you still need to compile it it to JavaScript. This way you get fast development lifecycle and in the end you can compile code to JS. Because it's compiled code there is lots more room for compiler to run optimisations on the code. So from my perspective, the compiler is still there and I don't think you would be able to replace code at runtime.
You can send around source code and run it, but it would need to be in a separate isolate. Isolates do have some relationship to Erlang concepts.
The Dart VM doesn't support hot swapping (Called live edit in V8). However, based on mailing list discussions, it sounds like this is something that the authors do want to support in the future.
However, as the others have mentioned, it is possible to dynamically load code into another isolate.

porting wireshark to qnx based system

I am a newbie to industry and as a part of my internship I have been assigned the above project.I have no experience in how to go about porting a particular application to a different OS.
So far,i have tried to understand the basic structure of a component(thats what an application is called IOS-XR) but as far as I can understand,porting wireshark will also require porting the libpcap lib to XR.
Can someone please shed some light as to how should i go about approaching it?
I know nothing about QNX;
However, I will note that Wireshark has a lot of dependencies on various libraries:
Some examples;
libgLib
libgtk
libffi-5
libfontconfig-1
libfreetype-6
libintl-8
libjasper-1
libjpeg-8
liblzma-5
libpixman-1-0
libpng15-15
libtiff-5
libxml2-2
...
Are these libraries available on QNX ?
With respect to libpcap:
libpcap is needed for capturing files. If not available, it certainly would need to be ported. I could imagine that this might be a large effort given that presumably the code is presumably quite dependent upon the exact OS capabilities to get access to the network level data.
For information about developing Wireshark (on Windows and *nix) see the
Wireshark Developer's Guide.

Building cross-platform Delphi applications

I downloaded Lazarus, but have worked with Embarcadero Delphi IDE too. I have a question about building cross-platform Delphi applications.
How can I build them under win32 environment? I read the wiki from Lazarus site, that explains how to do it, but I still do not understand it. Is is possible to build and compile application under win32 environment for Linux and MacOS? If it is possible, can someone explain ste-by-step how to do it exactly.
EDIT:
Now is the time for talking about the new XE2 version of the Delphi IDE I think :)
Thanks
What you're asking for already exists in the lazarus wiki site, you need to read these articles.
Multiplatform Programming Guide
Cross compiling
Cross compiling for Win32 under Linux
How to Write Portable Code (nice doc from Marco van de Voort)
Buildfaq
While crosscompiling to a non windows target is possible (and not that hard), getting used to fpc/lazarus and crosscompiling in one first step is a bridge too far. This because Linux is not a very homogenous target and dealing with this variation requires some understanding how libraries and linking works on Linux. This defeats one-button downloadable cross-compile setups to "general" linux. I know, such one-button thingies that work out of the box for everyone would be great, but it is just not going to happen (or only forvery limited distribution-version combinations)
Crosscompiling with FPC is not extremely difficult or rocket science, but the amount of jargon and details can flabbergast uninitiated people, and without background knowledge it is hard to diagnose problems as a result of minor misconfigurations
I recommend to first familiarize yourself with Lazarus/FPC, and only then make the crosscompilation leap. (and the already mentioned buildfaq names some reasons).
Bottomline: install lazarus on Windows and start porting your app. If that succeeds, start using a linux install (or VM) to familiarize yourself with Linux, and Lazarus under it. You'll need a linux install anyway to test.
Only then start thinking about crosscompiling to speed up the process.
CodeTyphon is a powerful Lazarus/FPC one click easy installation package for cross platform native development. It already supports 4 CPU/OS hosts (Win32, Win64, Linux32, Linux64), and 16 CPU/OS targets (arm-Wince, arm-Linux, arm-Embedded, arm-gba, arm-nds, i386-Win32, i386-Linux, i386-FreeBSD, i386-Haiku, x86_64-Win64, x86_64-Linux, x86_64-FreeBSD, powerpc-Linux, powerpc64-Linux, sparc-Linux, sparc-Solaris). More are supported in Lazarus/FreePascal, but others are not yet integrated in CodeTyphon. Did I mention that it is free? One code to rule them all ;-)
The point is that you don't have to waste days for setting up your cross platform environment, since someone has already done the hard work for you.

Resources