Apache-AuthenNTLM

 view release on metacpan or  search on metacpan

smb/smbval/session.c  view on Meta::CPAN


    /* No need to change RFCNB_errno as it was done by put_pkt ...     */

    return(RFCNBE_Bad);   /* Should be able to write that lot ... */
    
  }

  /* Now we have sent that lot, let's get rid of the RFCNB Header and return */

  pkt -> next = NULL;

  RFCNB_Free_Pkt(pkt);

  return(len);

}

/* We pick up a message from the internet ... We have to worry about 
   non-message packets ...                                           */

int RFCNB_Recv(void *con_Handle, struct RFCNB_Pkt *Data, int Length)

{ struct RFCNB_Pkt *pkt;
/*  struct RFCNB_Hdr *hdr; */
  int ret_len;

  if (con_Handle == NULL){

    RFCNB_errno = RFCNBE_BadHandle;
    RFCNB_saved_errno = errno;
    return(RFCNBE_Bad);

  }

  /* Now get a packet from below. We allocate a header first */

  /* Plug in the header and send the data */

  pkt = RFCNB_Alloc_Pkt(RFCNB_Pkt_Hdr_Len);

  if (pkt == NULL) {

    RFCNB_errno = RFCNBE_NoSpace;
    RFCNB_saved_errno = errno;
    return(RFCNBE_Bad);

  }

  pkt -> next = Data;  /* Plug in the data portion */

  if ((ret_len = RFCNB_Get_Pkt(con_Handle, pkt, Length + RFCNB_Pkt_Hdr_Len)) < 0) {

#ifdef RFCNB_DEBUG
    fprintf(stderr, "Bad packet return in RFCNB_Recv... \n");
#endif

    return(RFCNBE_Bad);

  }

  /* We should check that we go a message and not a keep alive */

  pkt -> next = NULL;

  RFCNB_Free_Pkt(pkt);

  return(ret_len);

}

/* We just disconnect from the other end, as there is nothing in the RFCNB */
/* protocol that specifies any exchange as far as I can see                */

int RFCNB_Hangup(struct RFCNB_Con *con_Handle)

{
  struct redirect_addr *redir_addr,*next;

  if (con_Handle != NULL) {
    RFCNB_Close(con_Handle -> fd);  /* Could this fail? */
    if (con_Handle -> redirect_list != NULL)
    {
	do { 
		redir_addr = con_Handle->redirect_list;
		next = redir_addr->next;
		free(redir_addr);
	} while(next!=NULL);
	}
    free(con_Handle);
  }

  return 0;


}

/* Set TCP_NODELAY on the socket                                          */

int RFCNB_Set_Sock_NoDelay(struct RFCNB_Con *con_Handle, BOOL yn)

{

  return(setsockopt(con_Handle -> fd, IPPROTO_TCP, TCP_NODELAY, 
		    (char *)&yn, sizeof(yn)));

}


/* Listen for a connection on a port???, when                             */
/* the connection comes in, we return with the connection                 */

void *RFCNB_Listen()

{
  return NULL;
}

/* Pick up the last error response as a string, hmmm, this routine should */
/* have been different ...                                                */

void RFCNB_Get_Error(char *buffer, int buf_len)



( run in 0.645 second using v1.01-cache-2.11-cpan-df04353d9ac )