Пример #1
0
static apr_status_t dso_cleanup(void *thedso)
{
    apr_dso_handle_t *dso = thedso;
    sym_list *symbol = NULL;
    void *NLMHandle = getnlmhandle();

    if (dso->handle == NULL)
        return APR_SUCCESS;

    if (dso->symbols != NULL) {
        symbol = dso->symbols;
        while (symbol) {
            UnImportPublicObject(NLMHandle, symbol->symbol);
            symbol = symbol->next;
        }
    }

    if (dlclose(dso->handle) != 0)
        return APR_EINIT;

    dso->handle = NULL;
    dso->symbols = NULL;
    dso->path = NULL;

    return APR_SUCCESS;
}
void netware_reg_user(const char *ip, const char *user,
		      const char *application)
{
  PMUR usage_request;
  long licRequestErrCode      = 0;
  long storeMeterInfoErrCode  = 0;
  long nlsMeterErrCode        = 0;

  /* import the symbol */
  usage_request= ((PMUR)ImportPublicObject(getnlmhandle(),
					   "PMMeteredUsageRequest"));
  if (usage_request != NULL)
  {
    unsigned long iaddr;
    char addr[NLS_IPX_ADDR_SIZE];

    /* create address */
    iaddr = htonl(inet_addr(ip));
    bzero(addr, NLS_IPX_ADDR_SIZE);
    memcpy(addr, &iaddr, NLS_IP_ADDR_SIZE);

    /* call to NLS */
    usage_request(user,
		  PM_USERINFO_TYPE_ADDRESS,
		  application,
		  NLS_TRAN_TYPE_IP,
		  addr,
		  PM_FLAGS_METER_ONLY,
		  &licRequestErrCode,
		  &storeMeterInfoErrCode,
		  &nlsMeterErrCode);
    /* release symbol */
    UnImportPublicObject(getnlmhandle(), "PMMeteredUsageRequest");
  }
}