iPXE
Data Structures | Defines | Enumerations | Functions
fcns.h File Reference

Fibre Channel name server lookups. More...

#include <stdint.h>
#include <ipxe/fc.h>

Go to the source code of this file.

Data Structures

struct  fc_ct_header
 A Fibre Channel Common Transport header. More...
struct  fc_ns_port_id
 A Fibre Channel name server port ID. More...
struct  fc_ns_gid_pn_request
 A Fibre Channel name server GID_PN request. More...
union  fc_ns_request
 A Fibre Channel name server request. More...
struct  fc_ns_reject_response
 A Fibre Channel name server rejection response. More...
struct  fc_ns_gid_pn_response
 A Fibre Channel name server GID_PN response. More...
union  fc_ns_response
 A Fibre Channel name server response. More...

Defines

#define FC_CT_REVISION   1
 Fibre Channel Common Transport revision.
#define FC_NS_CODE(command, key, value)   ( ( (command) << 8 ) | ( (key) << 4 ) | ( (value) << 0 ) )
 Construct Fibre Channel name server command code.
#define FC_NS_GET(key, value)   FC_NS_CODE ( FC_NS_GET, key, value )
 Construct Fibre Channel name server "get" command code.
#define FC_NS_REGISTER(key, value)   FC_NS_CODE ( FC_NS_REGISTER, key, value )
 Construct Fibre Channel name server "register" command code.
#define FC_NS_COMMAND(code)   ( ( (code) >> 8 ) & 0xf )
 Extract Fibre Channel name server command.
#define FC_NS_KEY(code)   ( ( (code) >> 4 ) & 0xf )
 Extract Fibre Channel name server key.
#define FC_NS_VALUE(code)   ( ( (code) >> 0 ) & 0xf )
 Extract Fibre Channel name server value.

Enumerations

enum  fc_gs_type { FC_GS_TYPE_DS = 0xfc }
 Fibre Channel generic service type. More...
enum  fc_gs_response_code { FC_GS_ACCEPT = 0x8002, FC_GS_REJECT = 0x8001 }
 Fibre Channel generic service response codes. More...
enum  fc_gs_reason_code {
  FC_GS_BAD_COMMAND = 0x01, FC_GS_BAD_VERSION = 0x02, FC_GS_ERROR = 0x03, FC_GS_BAD_SIZE = 0x04,
  FC_GS_BUSY = 0x05, FC_GS_EPROTO = 0x07, FC_GS_UNABLE = 0x09, FC_GS_ENOTSUP = 0x0b,
  FC_GS_UNAVAILABLE = 0x0d, FC_GS_SESSION = 0x0e
}
 Fibre Channel generic service rejection reason codes. More...
enum  fc_ds_subtype { FC_DS_SUBTYPE_NAME = 0x02 }
 Fibre Channel directory service subtype. More...
enum  fc_ns_command_nibble { FC_NS_GET = 0x1, FC_NS_REGISTER = 0x2, FC_NS_DEREGISTER = 0x3 }
 Fibre Channel name server commands. More...
enum  fc_ns_object_nibble {
  FC_NS_PORT_ID = 0x1, FC_NS_PORT_NAME = 0x2, FC_NS_NODE_NAME = 0x3, FC_NS_FC4_TYPES = 0x7,
  FC_NS_SYM_PORT_NAME = 0x8, FC_NS_SYM_NODE_NAME = 0x9, FC_NS_FC4_FEATURES = 0xf
}
 Fibre Channel name server objects. More...

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
int fc_ns_query (struct fc_peer *peer, struct fc_port *port, int(*done)(struct fc_peer *peer, struct fc_port *port, struct fc_port_id *peer_port_id))
 Issue Fibre Channel name server query.

Detailed Description

Fibre Channel name server lookups.

Definition in file fcns.h.


Define Documentation

#define FC_CT_REVISION   1

Fibre Channel Common Transport revision.

Definition at line 45 of file fcns.h.

Referenced by fc_ns_query_step().

#define FC_NS_CODE (   command,
  key,
  value 
)    ( ( (command) << 8 ) | ( (key) << 4 ) | ( (value) << 0 ) )

Construct Fibre Channel name server command code.

Parameters:
commandName server command
keyName server key
valueName server value
Return values:
codeName server command code

Definition at line 126 of file fcns.h.

#define FC_NS_GET (   key,
  value 
)    FC_NS_CODE ( FC_NS_GET, key, value )

Construct Fibre Channel name server "get" command code.

Parameters:
keyName server key
valueName server value to get
Return values:
codeName server command code

Definition at line 135 of file fcns.h.

#define FC_NS_REGISTER (   key,
  value 
)    FC_NS_CODE ( FC_NS_REGISTER, key, value )

Construct Fibre Channel name server "register" command code.

Parameters:
keyName server key
valueName server value to register
Return values:
codeName server command code

Definition at line 143 of file fcns.h.

#define FC_NS_COMMAND (   code)    ( ( (code) >> 8 ) & 0xf )

Extract Fibre Channel name server command.

Parameters:
codeName server command code
Return values:
commandName server command

Definition at line 150 of file fcns.h.

#define FC_NS_KEY (   code)    ( ( (code) >> 4 ) & 0xf )

Extract Fibre Channel name server key.

Parameters:
codeName server command code
Return values:
keyName server key

Definition at line 157 of file fcns.h.

#define FC_NS_VALUE (   code)    ( ( (code) >> 0 ) & 0xf )

Extract Fibre Channel name server value.

Parameters:
codeName server command code
Return values:
valueNAme server value

Definition at line 164 of file fcns.h.


Enumeration Type Documentation

enum fc_gs_type

Fibre Channel generic service type.

Enumerator:
FC_GS_TYPE_DS 

Directory service.

Definition at line 48 of file fcns.h.

                {
        /** Directory service */
        FC_GS_TYPE_DS = 0xfc,
};

Fibre Channel generic service response codes.

Enumerator:
FC_GS_ACCEPT 

Accepted.

FC_GS_REJECT 

Rejected.

Definition at line 54 of file fcns.h.

                         {
        /** Accepted */
        FC_GS_ACCEPT = 0x8002,
        /** Rejected */
        FC_GS_REJECT = 0x8001,
};

Fibre Channel generic service rejection reason codes.

Enumerator:
FC_GS_BAD_COMMAND 

Invalid command code.

FC_GS_BAD_VERSION 

Invalid version level.

FC_GS_ERROR 

Logical error.

FC_GS_BAD_SIZE 

Invalid CT_IU size.

FC_GS_BUSY 

Logical busy.

FC_GS_EPROTO 

Protocol error.

FC_GS_UNABLE 

Unable to perform command request.

FC_GS_ENOTSUP 

Command not supported.

FC_GS_UNAVAILABLE 

Server not available.

FC_GS_SESSION 

Session could not be established.

Definition at line 62 of file fcns.h.

                       {
        /** Invalid command code */
        FC_GS_BAD_COMMAND = 0x01,
        /** Invalid version level */
        FC_GS_BAD_VERSION = 0x02,
        /** Logical error */
        FC_GS_ERROR = 0x03,
        /** Invalid CT_IU size */
        FC_GS_BAD_SIZE = 0x04,
        /** Logical busy */
        FC_GS_BUSY = 0x05,
        /** Protocol error */
        FC_GS_EPROTO = 0x07,
        /** Unable to perform command request */
        FC_GS_UNABLE = 0x09,
        /** Command not supported */
        FC_GS_ENOTSUP = 0x0b,
        /** Server not available */
        FC_GS_UNAVAILABLE = 0x0d,
        /** Session could not be established */
        FC_GS_SESSION = 0x0e,
};

Fibre Channel directory service subtype.

Enumerator:
FC_DS_SUBTYPE_NAME 

Name server.

Definition at line 86 of file fcns.h.

                   {
        /** Name server */
        FC_DS_SUBTYPE_NAME = 0x02,
};

Fibre Channel name server commands.

Enumerator:
FC_NS_GET 

Get.

FC_NS_REGISTER 

Register.

FC_NS_DEREGISTER 

De-register.

Definition at line 92 of file fcns.h.

                          {
        /** Get */
        FC_NS_GET = 0x1,
        /** Register */
        FC_NS_REGISTER = 0x2,
        /** De-register */
        FC_NS_DEREGISTER = 0x3,
};

Fibre Channel name server objects.

Enumerator:
FC_NS_PORT_ID 

Port ID.

FC_NS_PORT_NAME 

Port name.

FC_NS_NODE_NAME 

Node name.

FC_NS_FC4_TYPES 

FC-4 types.

FC_NS_SYM_PORT_NAME 

Symbolic port name.

FC_NS_SYM_NODE_NAME 

Symbolic node name.

FC_NS_FC4_FEATURES 

FC-4 features.

Definition at line 102 of file fcns.h.

                         {
        /** Port ID */
        FC_NS_PORT_ID = 0x1,
        /** Port name */
        FC_NS_PORT_NAME = 0x2,
        /** Node name */
        FC_NS_NODE_NAME = 0x3,
        /** FC-4 types */
        FC_NS_FC4_TYPES = 0x7,
        /** Symbolic port name */
        FC_NS_SYM_PORT_NAME = 0x8,
        /** Symbolic node name */
        FC_NS_SYM_NODE_NAME = 0x9,
        /** FC-4 features */
        FC_NS_FC4_FEATURES = 0xf,
};

Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
int fc_ns_query ( struct fc_peer peer,
struct fc_port port,
int(*)(struct fc_peer *peer, struct fc_port *port, struct fc_port_id *peer_port_id)  done 
)

Issue Fibre Channel name server query.

Parameters:
peerFibre Channel peer
portFibre Channel port
Return values:
rcReturn status code

Definition at line 222 of file fcns.c.

References DBGC, done, fc_ns_query::done, ENOMEM, fc_ns_query_free(), fc_ntoa(), fc_peer_get(), fc_port_get(), intf_init(), fc_port::name, fc_ns_query::peer, fc_ns_query::port, fc_peer::port_wwn, fc_ns_query::process, process_init(), ref_init, ref_put, fc_ns_query::refcnt, fc_ns_query::xchg, and zalloc().

                                                                       {
        struct fc_ns_query *query;

        /* Allocate and initialise structure */
        query = zalloc ( sizeof ( *query ) );
        if ( ! query )
                return -ENOMEM;
        ref_init ( &query->refcnt, fc_ns_query_free );
        intf_init ( &query->xchg, &fc_ns_query_xchg_desc, &query->refcnt );
        process_init ( &query->process, &fc_ns_query_process_desc,
                       &query->refcnt );
        query->peer = fc_peer_get ( peer );
        query->port = fc_port_get ( port );
        query->done = done;

        DBGC ( query, "FCNS %p querying %s via %s\n",
               query, fc_ntoa ( &query->peer->port_wwn ), port->name );

        /* Mortalise self and return */
        ref_put ( &query->refcnt );
        return 0;
}