Read ARP cache from machine - cocoa

I'm working on a program that read arp cache from machine. I'm using Cocoa. There's a library called libdnet (libdnet.sourceforge.net) which has arp reading function. But I don't know how to write a code to use that function. Please help.

You'll need to know C and apply that knowledge to call the library's functions. See this question for links to C-learning resources.
Objective-C is a superset of C, so you'll be able to integrate the C code to call those functions into your Objective-C methods just fine once you know both languages.

Related

Dynamically loadable Linux security modules

I have seen many articles on LWN about allowing for dynamically loadable Linux security modules (LSM), but it is impossible to find concrete information on how it can be done. The LSM hooks (I don't know if this is the right term) aren't exported in the kernel anymore, but their addresses can be retrieved with kallsyms_lookup_name and then assigned to function declarations.
There are some mentions of LSM hooks not being unloadable, but is this true? What does it even mean? If a Linux loadable kernel module registers some hooks, is it unable to unregister them later? Why is this case? Is there a workaround or a way to force them to unload?
Do dynamically loadable LSMs have to be written differently than built-in LSMs? Or do both use the same conventions and interfaces?
It's technically possible to hotpatch the kernel to add hooks to anything. https://stackoverflow.com/a/6742086/2079814
Another possibility is to leverage kpatch to inject an LSM.
Neither of these options would be considered best practice, but should work in theory. I haven't seen the latter method (kpatch) done before.

Read CDPOS/CDHDR Sap tables using vbscript

I am trying to read sap change log using rfc + vbs as buffer.
I know that I need to use CHANGEDOCUMENT_READ_HEADERS and CHANGEDOCUMENT_READ_POSITIONS functions to do this, but have not found any research how to do this properly with the help of vbscript.
I have already found out how to read normal tables using BBP_RFC_READ_TABLE but it doesn’t work with CDPOS...
Any ideas?
First, if you want to use VBscript to integrate with SAP, you will go through RFC channel using SAP NWRFC library or SAP .Net Connector 3.0, and the SAP functions or BAPIs you can call must be remote enabled. Unfortunately, the two functions, CHANGEDOCUMENT_READ_HEADERS and CHANGEDOCUMENT_READ_POSITIONS, are not remote enabled. I could imagine CDPOS is difficult for you because CDPOS has wide fields which cannot be processed by BBP_RFC_READ_TABLE.
Once we are aligned with the objective challenges, there are two options to help you move forward:
Write your own custom "Z" function module, which is remote enabled, and call CHANGEDOCUMENT_READ_HEADERS and CHANGEDOCUMENT_READ_POSITIONS inside the function;
Use third party commercial library (our company AecorSoft developed such ADO.NET compliant library for SAP integration).
I would suggest you explore #1 first. You can follow this blog https://blogs.sap.com/2017/02/09/how-to-use-dotnet-connector-nco-inside-vba/ to get started.
Dunno about BBP_RFC_READ_TABLE but RFC_READ_TABLE perfectly reads CDPOS
If you need to header-based query you will need 2 sequential reads: first for CDHDR headers and the second for positions, constructing second query from the first.

How best to insert a stream of messages from a C app into RethinkDB

I have a C-based app which is collecting measurement streams which I want to dump in to RethinkDB. There is no need for any queries, just creating a table and inserting data. Is anybody aware of such as simple library?
There is the AtnNn/librethinkdbxx driver which I most likely could wrap easily, but it has no documentation and C++ and I don't get along well :)
RethinkDB protocol isn't that hard to write your own driver, like a simple C driver with write command support only
However, I propose that you abstract it and using a simple HTTP server to write into RethinkDB. You can do this with NodeJS in under 100 lines of code easily since you only need to write.

golang package for GT.M database

Is there any golang package already available to access GT.M database?
For example there is a package named mgo which is used to handle mongoDb
in go language. Similarly couchgomaster package is used to access couchDb
in go language.
I need to access GT.M database through go language.
There is not an existing binding between FIS GT.M (http://fis-gtm.com) and Go that I know of.
However, interfacing GT.M to any other language that can make C compatible calls is straightforward. Since I don't know Go, I'll answer in terms of C and you can adjust accordingly. To call from C to GT.M, create your preferred API in GT.M, create a file with the call-in table (a text file mapping C function names to GT.M function names). To call from GT.M to C, create C functions to call & compile them into a shared library, and create the call-out table. The GT.M Programmers Guide UNIX Edition Chapter 11 (Integrating External Routines) has examples you can download. [For all GT.M user documentation, go to the GT.M home page and click on the User Documentation tab.]
If you're more comfortable with Java than with C, you can use GTMJI (go to
http://sourceforge.net/projects/fis-gtm/files/Plugins/GTMJI/ and get the latest version), which provides call-ins between GT.M and Java. Documentation for GTMJI is on the GT.M user documentation page.
While GTMJI is developed by the GT.M development team, there are third party bindings that you can use / model, including node.js, Python (see OSEHRA and PyPI), Ruby, and Perl. While I know GT.M and GTMJI personally (I am part of the GT.M team), I know less about the third party bindings, although I do know that the node.js binding is in daily production use.
If you have further questions, please do ask.
No: the Greystone Technology M doesn't seem to have any public go project.
The go-search queries (for gtm or for greystone) don't return anything relevant.
Here is more info on interfacing natively with Go to C.
http://www.goinggo.net/2013/08/using-c-dynamic-libraries-in-go-programs.html
I believe you can write a little c program with required functions: gtm_init(), gtm_set(), gtm_get(), gtm_del() etc. and then interface with CGO

Confused about Thrift, what does it really do?

Can someone explain to me what thrift really does?
Say i have a Rails app, and I also have some code written in Scala.
Could thrift be used to generate an interface for my Scala code so that I could call it from Ruby?
Would the Scala code have to be written as a daemon for this to work?
I'm not really sure what Thrift's job is, other than it is used to link between various languages. Does it communicate over a socket?
Thrift is simply a binary serialization protocol. It is cross-language, so you can serialize in Scala, and then unserialize in Ruby.
Then you have to move the data, that's another story. You can use files, play directly with sockets, use a server, etc.
So how is this used for cross-platform development? Still not getting it!
Your Ruby and Scala code can reside on different machines running completely different OSes.

Resources