Eldred

Forum Replies Created

Viewing 8 posts - 16 through 23 (of 23 total)
  • Author
    Posts
  • in reply to: Developing a forwarding application #6885
    Eldred
    Participant

      There are probably packets, because I can see them if I run the sample of packetsniffer… Maybe an initialization problem or something ?

      in reply to: Developing a forwarding application #6883
      Eldred
      Participant

        Thanks for the link. I managed to compile my own program on another system, using the C interface. I can display the adapter list ; but I can’t ReadPacket(..) : it returns false.

        I don’t know what I am missing :

        TCP_AdapterList AdList;
        INTERMEDIATE_BUFFER PacketBuffer;
        ETH_REQUEST ReadRequest;
        ADAPTER_MODE Mode;

        ZeroMemory ( &ReadRequest, sizeof(ETH_REQUEST) );

        ZeroMemory ( &PacketBuffer, sizeof(INTERMEDIATE_BUFFER) );
        ReadRequest.hAdapterHandle = (HANDLE)AdList.m_nAdapterHandle[IFACE];

        ReadRequest.EthPacket.Buffer = &PacketBuffer;

        Mode.dwFlags = MSTCP_FLAG_SENT_LISTEN|MSTCP_FLAG_RECV_LISTEN;

        Mode.hAdapterHandle = (HANDLE)AdList.m_nAdapterHandle[IFACE];

        SetAdapterMode(hDrv,&Mode);

        int count = 0;
        while(ReadPacket(hDrv,&ReadRequest) && count<10)
        {
        cout<< PacketBuffer.m_Length< count++;
        }

        Is there a problem of initialization, or someting like that ? This code looks like the one from the sample, but… it can’t read anything although the sample can.

        in reply to: Developing a forwarding application #6881
        Eldred
        Participant

          Probably. How can I check this ?

          in reply to: Developing a forwarding application #6879
          Eldred
          Participant

            It still doesn’t work… I’m just trying to build this simple program that should display “0” :

            #include
            #include
            #include “Common.h”
            #include “ndisapi.h”
            #include

            int main()
            {
            printf(“%sn”,GetDriverVersion(NULL));
            return 0;
            }

            with g++ -o test main.cc -lndisapi

            I tried to link with the provided library, then mine ; and I still have a :

            D:DOCUME~1EldredLOCALS~1Temp/ccE1baaa.o(.text+0x2a):main.cc: undefined reference to `GetDriverVersion@4′

            I don’t understand…

            in reply to: Developing a forwarding application #6877
            Eldred
            Participant

              OK I get it, thank you.

              And I’m sorry, I edited my last post because I hadn’t see you had answered.

              in reply to: Developing a forwarding application #6875
              Eldred
              Participant

                About the 3g modem I can’t test it now but I remember I established the connection before to test and it didn’t appear in the list… It’s a particular modem that works in VPN mode only, does that change a thing ?

                About the build, I tried to build the library with my own compiler :

                g++ -c *.cpp
                ar -rc ndisapi.a *.o
                ar s ndisapi.a
                ren ndisapi.a ndisapi.lib

                Got the following errors when trying to build my program using this library :

                g++ -o ip_forward *.o -lndisapi
                main.o(.text+0x9c):main.cc: undefined reference to `_imp___ZN8CNdisApiC1EPKc’
                D:/Utilitaires/Programmation/MinGW/bin/../lib/gcc-lib/mingw32/3.3.1/../../..ndi
                sapi.lib(ndisapi.o.b)(.text+0x3c):ndisapi.cpp: undefined reference to `_imp___ZT
                V8CNdisApi’
                D:/Utilitaires/Programmation/MinGW/bin/../lib/gcc-lib/mingw32/3.3.1/../../..ndi
                sapi.lib(ndisapi.o.b)(.text+0x1e8):ndisapi.cpp: undefined reference to `_imp___Z
                TV8CNdisApi’
                D:/Utilitaires/Programmation/MinGW/bin/../lib/gcc-lib/mingw32/3.3.1/../../..ndi
                sapi.lib(ndisapi.o.b)(.text+0x391):ndisapi.cpp: undefined reference to `_imp___Z
                TV8CNdisApi’
                D:/Utilitaires/Programmation/MinGW/bin/../lib/gcc-lib/mingw32/3.3.1/../../..ndi
                sapi.lib(ndisapi.o.b)(.text+0x3f3):ndisapi.cpp: undefined reference to `_imp___Z
                TV8CNdisApi’
                D:/Utilitaires/Programmation/MinGW/bin/../lib/gcc-lib/mingw32/3.3.1/../../..ndi
                sapi.lib(ndisapi.o.b)(.text+0x455):ndisapi.cpp: undefined reference to `_imp___Z
                TV8CNdisApi’

                If I copy the dll file already build into the lib folder, it gives me :

                main.o(.text+0x26):main.cc: undefined reference to `GetDriverVersion@4′
                main.o(.text+0x9c):main.cc: undefined reference to `_imp___ZN8CNdisApiC1EPKc’
                main.o(.text+0xb9):main.cc: undefined reference to `CNdisApi::~CNdisApi()’

                Now I try to build the dll on my own, but same errors again :

                g++ -shared ndisapi.o -o ndisapi.dll
                ndisapi.o(.text+0x3c):ndisapi.cpp: undefined reference to `_imp___ZTV8CNdisApi’
                ndisapi.o(.text+0x1e8):ndisapi.cpp: undefined reference to `_imp___ZTV8CNdisApi’

                ndisapi.o(.text+0x391):ndisapi.cpp: undefined reference to `_imp___ZTV8CNdisApi’

                ndisapi.o(.text+0x3f3):ndisapi.cpp: undefined reference to `_imp___ZTV8CNdisApi’

                ndisapi.o(.text+0x455):ndisapi.cpp: undefined reference to `_imp___ZTV8CNdisApi’

                What am I missing ?

                in reply to: Developing a forwarding application #6873
                Eldred
                Participant

                  I installed the VirtNet interface and it should be easier to do the forwarding : if I’m able to check the packets’ source and destination, I’ll “just” have to call SendPacketsToAdapter() where ETH_M_REQUEST.hAdapterHandle is set to the handle of the virtnet interface.

                  I’m trying to build an example in order to learn how to use the API. I want to use the C++ class to integrate it into an existing program. But I use MinGW and the build fails :

                  C:UsersEldredDocumentssrc_testip_forward>g++ -o ip_forward main.cc -lndisapi
                  C:UsersEldredAppDataLocalTemp/ccO5lqAd.o:main.cc:(.text+0x19e): undefined r
                  eference to `_imp___ZN8CNdisApiC1EPKc’
                  C:UsersEldredAppDataLocalTemp/ccO5lqAd.o:main.cc:(.text+0x1bb): undefined r
                  eference to `CNdisApi::~CNdisApi()’

                  The link seems to be correct however, because if I don’t do this I have one more error. Any idea to fix this error ?

                  I also have another question : I ran listadapters.exe and it shew me a list of interfaces. Then, I plugged a 3G key and ran again the program : it shew me the same list as before. Is this normal ?

                  in reply to: Developing a forwarding application #6872
                  Eldred
                  Participant

                    Thank you very much for your answer.
                    @SerpentFly wrote:

                    Yes, this is possible. However you have to write the forwarding code by yourself.

                    Is there a documentation more detailed than the one provided with the samples ? I don’t know how to start…

                  Viewing 8 posts - 16 through 23 (of 23 total)