3

I need it for rewriting url, to know which friendly url I am processing. For User-Agent and other stuff.

EDIT:

public class Gwan
{
    [MethodImplAttribute(MethodImplOptions.InternalCall)]
    extern public static long getEnv(string arg, int name);
}

Gwan.xbufCat(Gwan.getReply(args[0]), Gwan.getEnv(args[0], 3).ToString());

Unhandled Exception: System.MissingMethodException: Cannot find the requested method. at (wrapper managed-to-native) Gwan:getEnv (string,int)

What am I doing wrong?

I guess on your end you need to put something like:

mono_add_internal_call ("Gwan::getEnv", get_env);

Dll in /cs folder where gwan_api also is not Loaded

Igor Golodnitsky
  • 4,456
  • 7
  • 44
  • 67
  • Is there any frameworks - for GWAN? – Igor Golodnitsky Oct 12 '14 at 09:02
  • G-WAN being a Web application server (with a rich API), people might not have felt the need to create a framework beyond what is already available. But there's certainly room for DB-agnostic wrappers, template libraries, etc. for people willing to use 'ready-to-wear' solutions, especially if you consider the flexibility of being able to use C/C++, C#/Java/Scala/PH7 **native** (and therefore superfast) scripts. – Gil Oct 13 '14 at 12:52

2 Answers2

2

Like for Java, G-WAN created some wrappers for the G-WAN C API. In both cases (Java and C#), these wrappers can be found under the gwan/libraries/cs directory.

Currently, the C# wrappers are:

// gwan_api.cs: exported G-WAN API calls for .NET C# servlets
using System;
using System.Runtime.CompilerServices;

public class Gwan
{
    [MethodImplAttribute(MethodImplOptions.InternalCall)]
    extern public static long getReply(string env);

    [MethodImplAttribute(MethodImplOptions.InternalCall)]
    extern public static void xbufCat(long reply, string mono_reply);

   [MethodImplAttribute(MethodImplOptions.InternalCall)]
   extern public static long cycles64();

   [MethodImplAttribute(MethodImplOptions.InternalCall)]
   extern public static long getNs   ();

   [MethodImplAttribute(MethodImplOptions.InternalCall)]
   extern public static long getUs   ();

   [MethodImplAttribute(MethodImplOptions.InternalCall)]
   extern public static long getMs   ();

   [MethodImplAttribute(MethodImplOptions.InternalCall)]
   extern public static void logErr  (long env, String msg);

   [MethodImplAttribute(MethodImplOptions.InternalCall)]
   extern public static void report  (long reply, int html_format);
}

But you can freely extend this file by adding more wrappers, either for the G-WAN C API, or for third-party C libraries loaded by your G-WAN scripts.

Hope this helps.


EDIT

You must implement the C# wrappers for any new G-WAN API (or external function) you want to support from your C# scripts.

The include file listed above is a mere list (not implementation).

Please refer to the Mono documentation for more details - or drop us a line at G-WAN if you want to sponsor the features you need.

Gil
  • 3,279
  • 1
  • 15
  • 25
0

I think you will have to look on their website for support information or experiment with the code to output the headers, try outputting them into a messagebox.show(headersvariable); to begin with

http://gwan.com/developers#tab3

REQUEST_LEN, // int REQUEST_LEN // strlen(REQUEST); with headers 
HTTP_HEADERS, // struct *http_t; // see struct http_t above
HEAD_XBUF, // xbuf_t*HEAD_XBUF; // response HTTP headers(), if any 
dazleer
  • 11
  • 2
  • I know it is possible for C scripts, but I need whole request data for C# available. Than we could create some kind of a framework to build web apps. Also would be usefull something that helps debug apps in Visual Studio before deploy to Gwan. – Igor Golodnitsky Oct 13 '14 at 09:43
  • Contact the G-WAN team for more options and a personalized answer. – Gil Oct 13 '14 at 12:54