#ifndef XG_PRIVATE_H #define XG_PRIVATE_H #include #include #include #include #include #include #include #include "xenctrl.h" #include char *xc_read_kernel_image(const char *filename, unsigned long *size); unsigned long csum_page (void * page); #define _PAGE_PRESENT 0x001 #define _PAGE_RW 0x002 #define _PAGE_USER 0x004 #define _PAGE_PWT 0x008 #define _PAGE_PCD 0x010 #define _PAGE_ACCESSED 0x020 #define _PAGE_DIRTY 0x040 #define _PAGE_PAT 0x080 #define _PAGE_PSE 0x080 #define _PAGE_GLOBAL 0x100 #if defined(__i386__) #define L1_PAGETABLE_SHIFT 12 #define L2_PAGETABLE_SHIFT 22 #define L1_PAGETABLE_SHIFT_PAE 12 #define L2_PAGETABLE_SHIFT_PAE 21 #define L3_PAGETABLE_SHIFT_PAE 30 #elif defined(__x86_64__) #define L1_PAGETABLE_SHIFT 12 #define L2_PAGETABLE_SHIFT 21 #define L3_PAGETABLE_SHIFT 30 #define L4_PAGETABLE_SHIFT 39 #endif #if defined(__i386__) #define ENTRIES_PER_L1_PAGETABLE 1024 #define ENTRIES_PER_L2_PAGETABLE 1024 #define L1_PAGETABLE_ENTRIES_PAE 512 #define L2_PAGETABLE_ENTRIES_PAE 512 #define L3_PAGETABLE_ENTRIES_PAE 4 #elif defined(__x86_64__) #define L1_PAGETABLE_ENTRIES 512 #define L2_PAGETABLE_ENTRIES 512 #define L3_PAGETABLE_ENTRIES 512 #define L4_PAGETABLE_ENTRIES 512 #endif #define PAGE_SHIFT XC_PAGE_SHIFT #define PAGE_SIZE (1UL << PAGE_SHIFT) #define PAGE_MASK (~(PAGE_SIZE-1)) typedef u32 l1_pgentry_32_t; typedef u32 l2_pgentry_32_t; typedef u64 l1_pgentry_64_t; typedef u64 l2_pgentry_64_t; typedef u64 l3_pgentry_64_t; typedef unsigned long l1_pgentry_t; typedef unsigned long l2_pgentry_t; #if defined(__x86_64__) typedef unsigned long l3_pgentry_t; typedef unsigned long l4_pgentry_t; #endif #if defined(__i386__) #define l1_table_offset(_a) \ (((_a) >> L1_PAGETABLE_SHIFT) & (ENTRIES_PER_L1_PAGETABLE - 1)) #define l2_table_offset(_a) \ ((_a) >> L2_PAGETABLE_SHIFT) #define l1_table_offset_pae(_a) \ (((_a) >> L1_PAGETABLE_SHIFT_PAE) & (L1_PAGETABLE_ENTRIES_PAE - 1)) #define l2_table_offset_pae(_a) \ (((_a) >> L2_PAGETABLE_SHIFT_PAE) & (L2_PAGETABLE_ENTRIES_PAE - 1)) #define l3_table_offset_pae(_a) \ (((_a) >> L3_PAGETABLE_SHIFT_PAE) & (L3_PAGETABLE_ENTRIES_PAE - 1)) #elif defined(__x86_64__) #define l1_table_offset(_a) \ (((_a) >> L1_PAGETABLE_SHIFT) & (L1_PAGETABLE_ENTRIES - 1)) #define l2_table_offset(_a) \ (((_a) >> L2_PAGETABLE_SHIFT) & (L2_PAGETABLE_ENTRIES - 1)) #define l3_table_offset(_a) \ (((_a) >> L3_PAGETABLE_SHIFT) & (L3_PAGETABLE_ENTRIES - 1)) #define l4_table_offset(_a) \ (((_a) >> L4_PAGETABLE_SHIFT) & (L4_PAGETABLE_ENTRIES - 1)) #endif #define ERROR(_m, _a...) \ do { \ int __saved_errno = errno; \ fprintf(stderr, "ERROR: " _m "\n" , ## _a ); \ errno = __saved_errno; \ } while (0) #define PERROR(_m, _a...) \ do { \ int __saved_errno = errno; \ fprintf(stderr, "ERROR: " _m " (%d = %s)\n" , ## _a , \ __saved_errno, strerror(__saved_errno)); \ errno = __saved_errno; \ } while (0) struct domain_setup_info { unsigned long v_start; unsigned long v_end; unsigned long v_kernstart; unsigned long v_kernend; unsigned long v_kernentry; unsigned int load_symtab; unsigned int pae_kernel; unsigned long symtab_addr; unsigned long symtab_len; }; typedef int (*parseimagefunc)(char *image, unsigned long image_size, struct domain_setup_info *dsi); typedef int (*loadimagefunc)(char *image, unsigned long image_size, int xch, u32 dom, unsigned long *parray, struct domain_setup_info *dsi); struct load_funcs { parseimagefunc parseimage; loadimagefunc loadimage; }; #define mfn_mapper_queue_size 128 typedef struct mfn_mapper { int xc_handle; int size; int prot; int error; int max_queue_size; void * addr; privcmd_mmap_t ioctl; } mfn_mapper_t; unsigned long xc_get_m2p_start_mfn (int xc_handle); int xc_copy_to_domain_page(int xc_handle, u32 domid, unsigned long dst_pfn, void *src_page); unsigned long xc_get_filesz(int fd); void xc_map_memcpy(unsigned long dst, char *src, unsigned long size, int xch, u32 dom, unsigned long *parray, unsigned long vstart); int pin_table(int xc_handle, unsigned int type, unsigned long mfn, domid_t dom); /* image loading */ int probe_elf(char *image, unsigned long image_size, struct load_funcs *funcs); int probe_bin(char *image, unsigned long image_size, struct load_funcs *funcs); int probe_aout9(char *image, unsigned long image_size, struct load_funcs *funcs); #endif 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
package com.trilead.ssh2;

/**
 * An <code>InteractiveCallback</code> is used to respond to challenges sent
 * by the server if authentication mode "keyboard-interactive" is selected.
 * 
 * @see Connection#authenticateWithKeyboardInteractive(String,
 *      String[], InteractiveCallback)
 * 
 * @author Christian Plattner, plattner@trilead.com
 * @version $Id: InteractiveCallback.java,v 1.1 2007/10/15 12:49:56 cplattne Exp $
 */

public interface InteractiveCallback
{
	/**
	 * This callback interface is used during a "keyboard-interactive"
	 * authentication. Every time the server sends a set of challenges (however,
	 * most often just one challenge at a time), this callback function will be
	 * called to give your application a chance to talk to the user and to
	 * determine the response(s).
	 * <p>
	 * Some copy-paste information from the standard: a command line interface
	 * (CLI) client SHOULD print the name and instruction (if non-empty), adding
	 * newlines. Then for each prompt in turn, the client SHOULD display the
	 * prompt and read the user input. The name and instruction fields MAY be
	 * empty strings, the client MUST be prepared to handle this correctly. The
	 * prompt field(s) MUST NOT be empty strings.
	 * <p>
	 * Please refer to draft-ietf-secsh-auth-kbdinteract-XX.txt for the details.
	 * <p>
	 * Note: clients SHOULD use control character filtering as discussed in
	 * RFC4251 to avoid attacks by including
	 * terminal control characters in the fields to be displayed.
	 * 
	 * @param name
	 *            the name String sent by the server.
	 * @param instruction
	 *            the instruction String sent by the server.
	 * @param numPrompts
	 *            number of prompts - may be zero (in this case, you should just
	 *            return a String array of length zero).
	 * @param prompt
	 *            an array (length <code>numPrompts</code>) of Strings
	 * @param echo
	 *            an array (length <code>numPrompts</code>) of booleans. For
	 *            each prompt, the corresponding echo field indicates whether or
	 *            not the user input should be echoed as characters are typed.
	 * @return an array of reponses - the array size must match the parameter
	 *         <code>numPrompts</code>.
	 */
	public String[] replyToChallenge(String name, String instruction, int numPrompts, String[] prompt, boolean[] echo)
			throws Exception;
}